https://www.acmicpc.net/problem/15657
# 2022.12.30
import sys
input = sys.stdin.readline
n, m = map(int, input().split())
number = list(map(int, input().split()))
number = sorted(number)
answer = []
def backtracking(start):
if len(answer)==m:
print(' '.join(map(str, answer)))
return
for i in range(start, n):
answer.append(number[i])
backtracking(i)
answer.pop()
backtracking(0)
'Problem Solving > BOJ' 카테고리의 다른 글
[Backtracking] 15666 N과 M(12) (0) | 2022.12.30 |
---|---|
[Backtracking] 15663 N과 M(9) (0) | 2022.12.30 |
[Backtracking] 15654 N과 M(5) (0) | 2022.12.30 |
[Backtracking] 15652 N과 M(4) (0) | 2022.12.30 |
[Backtracking] 15649 N과 M(1) (1) | 2022.12.30 |