문제요약
나의 코드 및 설명
def dfs(count):
if count == m:
print(" ".join(map(str, ans)))
return
if count == n:
return
for i in range(n):
ans.append(num_list[i])
dfs(count+1)
ans.pop()
n, m = map(int, input().split())
num_list = list(map(int, input().split()))
num_list.sort()
ans = []
dfs(0)
'Baekjoon > 백트래킹' 카테고리의 다른 글
[백준] 15663 N과 M (9) (실버2) / 백트래킹, 파이썬튜터, shallow copy(얕은 복사) (0) | 2023.04.14 |
---|---|
[백준] 15657 N과 M (8) (실버3) / 백트래킹 (0) | 2023.04.14 |
[백준] 15655 N과 M (6) (실버3) / 백트래킹 (0) | 2023.04.14 |
[백준] 15654 N과 M (5) (실버3) / 백트래킹 (0) | 2023.04.14 |
[백준] 15652 N과 M (4) (실버3) / 백트래킹 (0) | 2023.04.13 |