Cod sursa(job #387689)

Utilizator mimarcelMoldovan Marcel mimarcel Data 28 ianuarie 2010 10:13:22
Problema Submultimi Scor 100
Compilator fpc Status done
Runda Arhiva educationala Marime 0.71 kb
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.