Pagini recente » Cod sursa (job #3139235) | Cod sursa (job #2978860) | Cod sursa (job #2464140) | Cod sursa (job #1103802) | Cod sursa (job #147156)
Cod sursa(job #147156)
var v,l:array[0..100]of longint;
n,i,j,k,t:longint;
f:text;
procedure back(x:longint);
var y:longint;
begin
for y:=1 to n do
if l[y]=0 then begin l[y]:=1;
v[x]:=y;
if x<n then back(x+1)
else begin for i:=1 to n do
write(f,v[i],' ');
writeln(f);
end;
l[y]:=0;
end;
end;
begin
assign(f,'permutari.in');
reset(f);
read(f,n);
close(f);
assign(f,'permutari.out');
rewrite(f);
back(1);
close(f);
end.