Files
CodeObject/zeta_python/completed/15649_recursive.py
2019-11-19 14:24:24 +09:00

11 lines
276 B
Python

n, m = map(int, input().split())
def solve(ns, m):
for i in range(1, n+1):
if i in ns:
continue
else:
if m == 1:
print(" ".join(map(str, ns+(i,))))
else:
solve(ns+(i,), m - 1)
solve((), m)