15 lines
219 B
Text
15 lines
219 B
Text
n = 5
|
|
m = 3
|
|
len result[] m
|
|
#
|
|
proc combinations pos val .
|
|
if pos > m
|
|
print result[]
|
|
return
|
|
.
|
|
for i = val to pos + n - m
|
|
result[pos] = i
|
|
combinations pos + 1 i + 1
|
|
.
|
|
.
|
|
combinations 1 1
|