Pagini recente » Cod sursa (job #1461931) | Cod sursa (job #1857348) | Cod sursa (job #988890) | Cod sursa (job #2045224) | Cod sursa (job #574484)
Cod sursa(job #574484)
var a,x:array[1..1000] of integer;
i,n,k:integer;
procedure afisare;
begin
for i:=1 to k do
write(a[x[i]],' ');
writeln;
end;
procedure back(t:integer);
var i:integer;
begin
for i:=x[t-1]+1 to n-k+t do
begin
x[t]:=i;
if t=k then afisare
else back(k+1);
end;
end;
begin
assign(input,'permutari.in');reset(input);
assign(output,'permutari.out');rewrite(output);
readln(n,k);
for i:=1 to n do read(a[i]);
back(1);
end.