pascal用lazaurs为什么会出现调试器错误 ,那些原因会导致这种情况?
有需要的话,我打的程序如下,按理至少能运行吧....可是连开都开不起来programProject1;vara,b,c,h:array[1..1000]oflongint...
有需要的话,我打的程序如下,按理至少能运行吧....可是连开都开不起来
program Project1;
var a,b,c,h:array [1..1000] of longint;d,f,e,t,x,g,he:longint;
procedure zuo(i,m,n:longint);
begin
if i>=1 then
begin
if a[i+m-1]>e then
begin
d:=d+1;
zuo(i-1,m,n);
end
else
begin
d:=d+1;
zuo(i-1,m,n);
d:=d-1;
b[t]:=d;
t:=t+1;
e:=a[i+m-1];
zuo(i-1,m,n)
end;
end;
if i=1 then b[t+1]:=d;
end;
procedure you(i,m,n:longint);
begin
if i<=n+1-m then
begin
if a[i+m-1]>e then
begin
d:=d+1;
you(i+1,m,n);
end
else
begin
d:=d+1;
zuo(i+1,m,n);
d:=d-1;
c[t]:=d;
t:=t+1;
e:=a[i+m-1];
you(i+1,m,n)
end;
end;
if i=n+1-m then c[t+1]:=d;
end;
begin
read(x);
d:=0;
for t:=1 to x do
begin
read(a[t]);
end;
for he:=1 to x do
begin
t:=1;
if he <>1 then
begin
f:=x;
zuo(he-1,1,he-1);
for e:=1 to t+1 do
if b[e]<f then f:=b[e];
end;
t:=1;
if he<>x then
begin
g:=x;
you(1,he+1,x);
for e:=1 to t+1 do
if c[e]<g then g:=c[e];
end;
h[he]:=f+g;
end;
f:=x;
for he:=1 to x do
if h[he]<f then f:=h[he];
write(f);
readln;
readln;
end. 展开
program Project1;
var a,b,c,h:array [1..1000] of longint;d,f,e,t,x,g,he:longint;
procedure zuo(i,m,n:longint);
begin
if i>=1 then
begin
if a[i+m-1]>e then
begin
d:=d+1;
zuo(i-1,m,n);
end
else
begin
d:=d+1;
zuo(i-1,m,n);
d:=d-1;
b[t]:=d;
t:=t+1;
e:=a[i+m-1];
zuo(i-1,m,n)
end;
end;
if i=1 then b[t+1]:=d;
end;
procedure you(i,m,n:longint);
begin
if i<=n+1-m then
begin
if a[i+m-1]>e then
begin
d:=d+1;
you(i+1,m,n);
end
else
begin
d:=d+1;
zuo(i+1,m,n);
d:=d-1;
c[t]:=d;
t:=t+1;
e:=a[i+m-1];
you(i+1,m,n)
end;
end;
if i=n+1-m then c[t+1]:=d;
end;
begin
read(x);
d:=0;
for t:=1 to x do
begin
read(a[t]);
end;
for he:=1 to x do
begin
t:=1;
if he <>1 then
begin
f:=x;
zuo(he-1,1,he-1);
for e:=1 to t+1 do
if b[e]<f then f:=b[e];
end;
t:=1;
if he<>x then
begin
g:=x;
you(1,he+1,x);
for e:=1 to t+1 do
if c[e]<g then g:=c[e];
end;
h[he]:=f+g;
end;
f:=x;
for he:=1 to x do
if h[he]<f then f:=h[he];
write(f);
readln;
readln;
end. 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询