Cod sursa(job #600179)
| Utilizator | Data | 30 iunie 2011 18:15:12 | |
|---|---|---|---|
| Problema | Submultimi | Scor | 100 |
| Compilator | fpc | Status | done |
| Runda | Arhiva educationala | Marime | 0.43 kb |
program submultimi;
var i,n,nr_sub,temp,count,r:longint;
f:text;
begin
assign(f,'submultimi.in'); reset(f);
readln(f,n);
close(f);
assign(f,'submultimi.out'); rewrite(f);
nr_sub := trunc(exp(n*ln(2))) - 1;
for i:=1 to nr_sub do begin
temp := i;
count := 0;
while (temp <> 0) do begin
count := count + 1;
r := temp mod 2;
temp := temp div 2;
if (r=1) then write(f,count,' ');
end;
writeln(f);
end;
writeln(f);
close(f);
end.
