알고리즘/백준 문제풀이
[boj] 백준 15652 N과 M (4) python 풀이
감자156
2023. 8. 4. 13:00
반응형
문제
https://www.acmicpc.net/problem/15652
문제 풀이
백트래킹 기본
코드
import sys
input = sys.stdin.readline
N, M = map(int, input().split())
total = []
def back(s):
if len(total) == M:
print(*total)
return
for i in range(s,N):
total.append(i+1)
back(i)
total.pop()
back(0)
반응형