主题:[原创][下载]递归的排列与组合
Var
a: array [1..9] of byte;
n: byte;
Procedure sub(s:byte);
Var
i,j: byte;
Begin
If s > n then begin
For j:=1 to n do write(a[j]:2);
Writeln;
End
else
For i:=1 to n do begin
a[s]:=i;
sub(s+1);
End;
End;
Begin
Repeat
Write('N= '); readln(n);
Until n in [1..9];
Sub(1);
readln;
END.
a: array [1..9] of byte;
n: byte;
Procedure sub(s:byte);
Var
i,j: byte;
Begin
If s > n then begin
For j:=1 to n do write(a[j]:2);
Writeln;
End
else
For i:=1 to n do begin
a[s]:=i;
sub(s+1);
End;
End;
Begin
Repeat
Write('N= '); readln(n);
Until n in [1..9];
Sub(1);
readln;
END.