Cod sursa(job #155252)
Utilizator | Robert Hangu Robybrasov | Data | 11 martie 2008 20:24:53 |
---|---|---|---|
Problema | Combinari | Scor | 100 |
Compilator | fpc | Status | done |
Runda | Arhiva educationala | Marime | 0.43 kb |
var n,k:byte;
st:array[0..18] of byte;
f:text;
procedure comb(p:byte);
var i,j:byte;
begin
for i:=st[p-1]+1 to n do
begin
st[p]:=i;
if p=k then begin for j:=1 to k do write(f,st[j],' '); writeln(f); end
else comb(p+1);
end;
end;
begin
assign(f,'combinari.in');
reset(f);
read(f,n,k);
close(f);
assign(f,'combinari.out');
rewrite(f);
comb(1);
close(f);
end.