알고리즘 문제 풀기/백준(Baekjoon)
[백준 알고리즘] 15655. N과 M (6) - 조합
hibscus
2021. 3. 20. 21:14
조합이 조하요
#### 조합
N, M = map(int, input().split())
num = list(map(int, input().split()))
num.sort()
choice = [0] * M
def comb(idx, start):
if idx == M:
print(" ".join(map(str, choice)))
return
for i in range(start, N):
choice[idx] = num[i]
comb(idx+1, i+1)
comb(0, 0)