백트래킹_N과M(1)

Eugenius1st·2022년 9월 28일
0

Algorithm_Baekjoon

목록 보기
135/158
post-thumbnail

백트래킹

문제



코드

import sys
#sys.stdin=open("input.txt", "rt")

M, N = map(int,input().split())
s = []

def dfs():
    if len(s)==N :
        print(' '.join(map(str,s)))
        return 
    for i in range(1,M+1):
        if i not in s:
            s.append(i)
            dfs()
            s.pop()
dfs()
profile
최강 프론트엔드 개발자가 되고싶은 안유진 입니다

0개의 댓글