var
answer: array of Integer
//存储答案
data: array of Integer
//存储所有数字
procedure GetNumber(No: Integer);
var
i, j:integer;
begin
for i := answer[no -1] + 1 to all - allget + no do
begin
answer[no] := i;
if no = allget then
begin
for j := 1 to allget do
write(data[answer[j]],' ');
end;
end;
end;
all := 15;
allget := 7;
for i := 1 to all - allget do
begin
answer[1] := i;
getNumber(2);
end;
var
n, r, i, j, k: Integer;
a, b: array [0..100] of Integer;
begin
Write('Input n, r:');
Read(n, r);
for i := 1 to r do
begin
a := i;
b := n - r + i;
end;
k := r;
j := 0;
Writeln('Combination: ');
repeat
if k = r then
begin
j := j + 1;
Write('No.', j:3, '[');
for i := 1 to r do write(a, ' ');
Writeln(']');
end;
if a[k] &lt
b[k] then
begin
a[k] := a[k] + 1;
if k &lt
r then
for k := k + 1 to r do a[k] := a[k - 1] + 1;
end
else
k := k - 1;
until k = 0;
end.
var
n, r, i, j, k: Integer;
a, b: array [0..100] of Integer;
x: array [1..5] of Integer;
begin
// Write('Input n, r:');
// Read(n, r);
n := 5;
r := 4;
x[1] := 10;
x[2] := 11;
x[3] := 12;
x[4] := 13;
x[5] := 14;
for i := 1 to r do
begin
a := i;
b := n - r + i;
end;
k := r;
j := 0;
Writeln('Combination: ');
repeat
if k = r then
begin
j := j + 1;
Write('No.', j:3, '[');
for i := 1 to r do write(x[a], ' ');
Writeln(']');
end;
if a[k] &lt
b[k] then
begin
a[k] := a[k] + 1;
if k &lt
r then
for k := k + 1 to r do a[k] := a[k - 1] + 1;
end
else
k := k - 1;
until k = 0;
Readln;
end.