Pagini recente » Cod sursa (job #294409) | Cod sursa (job #2552289) | Cod sursa (job #161229) | Cod sursa (job #1346229) | Cod sursa (job #413425)
Cod sursa(job #413425)
const infile='submultimi.in';
outfile='submultimi.out';
maxn=16;
var s:array[1..maxn]of longint;
n:longint;
procedure solve;
var i,j,k,x:longint;
begin
assign(output,outfile); rewrite(output);
for i:=1 to n do s[i]:=1 shl (n-i);
k:=1 shl n;
for i:=1 to k-1 do begin
x:=0; j:=1;
while(j<=n)and(x<i)do begin
if(x<i-s[j])then inc(x,s[j])
else begin inc(x); write(j,' '); end;
inc(j);
end;
writeln;
end;
close(output);
end;
begin
assign(input,infile); reset(input); readln(n); close(input);
solve;
end.