2025-07-23 00:02:58 +09:00

12 lines
259 B
Python

def dfs(now, N, M, result) :
if len(result) == M :
print(*result)
return
for next in range(now, N+1) :
result.append(next)
dfs(next+1,N,M,result)
result.pop()
N, M = map(int, input().split())
dfs(1,N,M,[])