主题:出错啦,帮我看看
帮我看看程序,谢了,我也不知哪出错了
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.
此帖转自:[url]http://www.programfan.com/team/team.asp?team_id=1413[/url]
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.
此帖转自:[url]http://www.programfan.com/team/team.asp?team_id=1413[/url]