白駿15656:NとM(7)(Python)
正しいコード
N, M = map(int, input().split())
arr = list(map(int, input().split()))
arr.sort()
res = []
def dfs(cnt):
if cnt == M:
for i in res:
print(i, end=' ')
print()
return
for i in range(N):
res.append(arr[i])
dfs(cnt + 1)
res.pop()
dfs(0)
質問のタイプ
遡及(DFS)
Reference
この問題について(白駿15656:NとM(7)(Python)), 我々は、より多くの情報をここで見つけました https://velog.io/@yibangwon/백준-15656-N과-M-7-파이썬テキストは自由に共有またはコピーできます。ただし、このドキュメントのURLは参考URLとして残しておいてください。
Collection and Share based on the CC Protocol