Pagini recente » Cod sursa (job #1942780) | Cod sursa (job #1752432) | Cod sursa (job #2916355) | Cod sursa (job #598074) | Cod sursa (job #548923)
Cod sursa(job #548923)
var a:array[1..100]of longint;
n,k:longint; f:text;
procedure afis;
var i:longint;
begin
for i:=1 to n do write(f,a[i]);writeln(f);
end;
procedure perm(k:longint);
var i,j:longint;
b:boolean;
begin
if k=n then afis else
begin
for i:=1 to n do
begin
b:=true;
for j:=1 to k do
if a[j]=i then begin b:=false; break; end;
if b then begin a[k+1]:=i; perm(k+1); end;
end;
end;
end;
begin
assign(f,'permutari.in');
reset(f);
readln(f,n);
close(f);
assign(f,'permutari.out');
rewrite(f);
perm(0);
close(f);
end.