Pagini recente » Cod sursa (job #2503255) | Cod sursa (job #3269508) | Cod sursa (job #2145560) | Cod sursa (job #11383) | Cod sursa (job #387689)
Cod sursa(job #387689)
const masca:array[1..16]of word=(
1shl 0,1shl 1,1shl 2,1shl 3,1shl 4,1shl 5,1shl 6,1shl 7,1shl 8,1shl 9,
1shl 10,1shl 11,1shl 12,1shl 13,1shl 14,1shl 15);
var n,j:byte;
i:word;
procedure afsol;
begin
for i:=1 to 1 shl n-1do
begin
for j:=1 to n do if i and masca[j]<>0 then begin
write(j);
break;
end;
for j:=j+1 to n do if i and masca[j]<>0 then write(' ',j);
writeln;
end;
end;
begin
assign(input,'submultimi.in');
reset(input);
assign(output,'submultimi.out');
rewrite(output);
read(n);
afsol;
close(input);
close(output);
end.