백준 15650번 : N과 M (2)

상은·2022년 4월 15일
0

백준문제

목록 보기
9/12
n,m = map(int,input().split())
sol = []

def recur(cur):
    if len(sol) == m :
        print(' '.join(map(str,sol)))
        return

    for i in range(cur,n+1):
        if i not in sol:
            sol.append(i)
            recur(i+1)
            sol.pop()
recur(1)
profile
Be the Best

0개의 댓글