Pagini recente » Cod sursa (job #747733) | Cod sursa (job #1329137) | Cod sursa (job #1311233) | Cod sursa (job #899580) | Cod sursa (job #720240)
Cod sursa(job #720240)
type vector=array[1..100]of integer;
var a:vector; n,m:integer; t:text;
procedure afis;
var i,j:integer; b:boolean;
begin
b:=true;
for i:=1 to n do
begin
if a[i]=0 then b:=false;
end;
for i:=1 to n-1 do
for j:=i+1 to n do
if a[i]=a[j] then b:=false;
if (b=true) then for i:=1 to n do
begin
write(t,a[i],' ');
end;
if (b=true) then writeln(t);
end;
procedure bin(p:integer);
var i,j:integer;
begin
if p>n then afis
else
begin
for j:=0 to n do
begin
a[p]:=j;
bin(p+1)
end;
end;
end;
begin
assign(t,'permutari.in');
reset(t);
readln(t,n);
close(t);
assign(t,'permutari.out');
rewrite(t);
bin(1);
close(t);
end.