BOJ15656 N과 M 7

randi65535·2020년 11월 27일
import sys
sys.setrecursionlimit((10**5))

N, M = map(int, input().split())

elem = list(map(int, input().split()))
elem.sort()

check = [0] * N
ans = [0] * N

def recur(depth):
	if depth == M:
		print(' '.join(map(str, ans[:M])))
		return
	for i in range(N):
		ans[depth] = elem[i]
		recur(depth+1)
		ans[depth] = 0	
	
recur(0)
profile
unsinged int 8byte-1

0개의 댓글