Cod sursa(job #1198922)
| Utilizator | Data | 17 iunie 2014 17:35:02 | |
|---|---|---|---|
| Problema | Generare de permutari | Scor | 100 |
| Compilator | fpc | Status | done |
| Runda | Arhiva educationala | Marime | 0.55 kb |
var n:byte;
procedure cod(s:string);
var i,j:byte;
c:string;
ok:boolean;
begin
if length(s)=n then begin for i:=1 to n do write(s[i],' ');writeln;end
else
begin
for i:=1 to n do
begin
str(i,c);
ok:=false;
for j:=1 to length(s) do if s[j]=c[1] then ok:=true;
if not ok then cod(s+c[1]);
end;
end;
end;
begin
assign(input,'permutari.in');
reset(input);
read(n);
close(input);
assign(output,'permutari.out');
rewrite(output);
cod('');
close(output);
end.