主题:[讨论]出错啦,帮我看看
program muji;
uses crt;
var a:array[1..50]of integer;
q,j,i,m,n:integer;
procedure print;
var j:integer;
begin
write('(');
for j:=1 to i do
write(a[j]);
write(')');i:=i-1;
end;
procedure dg(st,m:integer);
var j,b:integer;
begin
if m=0 then print
else for b:=st to n-m+1 do begin
i:=i+1;a[i]:=b;dg(b+1,m-1);
end;
end;
begin
writeln('n=?');
readln(n);
for j:=1 to n do
begin
i:=0;
dg(1,j);
end;
end.
end.[size=5][/size]
uses crt;
var a:array[1..50]of integer;
q,j,i,m,n:integer;
procedure print;
var j:integer;
begin
write('(');
for j:=1 to i do
write(a[j]);
write(')');i:=i-1;
end;
procedure dg(st,m:integer);
var j,b:integer;
begin
if m=0 then print
else for b:=st to n-m+1 do begin
i:=i+1;a[i]:=b;dg(b+1,m-1);
end;
end;
begin
writeln('n=?');
readln(n);
for j:=1 to n do
begin
i:=0;
dg(1,j);
end;
end.
end.[size=5][/size]