2023-07-01 11:58:00 -04:00
|
|
|
n = 5
|
|
|
|
|
m = 3
|
|
|
|
|
len result[] m
|
|
|
|
|
#
|
2025-06-11 20:16:52 -04:00
|
|
|
proc combinations pos val .
|
2024-07-13 15:19:22 -07:00
|
|
|
if pos > m
|
2023-09-16 17:28:03 -07:00
|
|
|
print result[]
|
2024-07-13 15:19:22 -07:00
|
|
|
return
|
|
|
|
|
.
|
|
|
|
|
for i = val to pos + n - m
|
|
|
|
|
result[pos] = i
|
|
|
|
|
combinations pos + 1 i + 1
|
2023-09-16 17:28:03 -07:00
|
|
|
.
|
2023-07-01 11:58:00 -04:00
|
|
|
.
|
2024-07-13 15:19:22 -07:00
|
|
|
combinations 1 1
|