
请问各位精通PASCAL语言的长兄们,运行错误202(栈溢出)一般采用什么东西来处理? 5
vars:array[0..1000]oflongint;y:array[0..1000]oflongint;a,b,i,j:longint;procedurezj(t,...
var s:array[0..1000]of longint;
y:array[0..1000]of longint;
a,b,i,j:longint;
procedure zj(t,c:longint);
begin
if s[t]>c then
begin
if i>1 then dec(i);
zj(t-1,c);
end
else
if s[t]<=c then
begin
y[i]:=s[t];
zj(t,c-s[t]);
inc(i);
end
else
if c=0 then
begin
for j:=1 to i do
write(y[i],' ');
end;
write('No solution!');
end;
begin
readln(a,b);
for j:=1 to a do
read(s[j]);
i:=1;
zj(a,b);
end.
程序有错吗 展开
y:array[0..1000]of longint;
a,b,i,j:longint;
procedure zj(t,c:longint);
begin
if s[t]>c then
begin
if i>1 then dec(i);
zj(t-1,c);
end
else
if s[t]<=c then
begin
y[i]:=s[t];
zj(t,c-s[t]);
inc(i);
end
else
if c=0 then
begin
for j:=1 to i do
write(y[i],' ');
end;
write('No solution!');
end;
begin
readln(a,b);
for j:=1 to a do
read(s[j]);
i:=1;
zj(a,b);
end.
程序有错吗 展开
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询