티스토리 뷰
https://www.acmicpc.net/problem/15652
import sys
N, M = map(int, sys.stdin.readline().split())
res = [0] * M
check = [0] * N
def go(index, start, n, m):
if index == m:
print(*res)
return
else:
for i in range(start, n+1):
check[i-1] = 1
res[index] = i
go(index+1, i, n, m)
check[i-1] = 0
go(0, 1, N, M)
'Algorithm > Baekjoon' 카테고리의 다른 글
[백준] 2455 : 지능형 기차 - Python (0) | 2020.04.16 |
---|---|
[백준] 2579 : 계단 오르기 - Python (0) | 2020.04.15 |
[백준] 15651 : N과 M (3) - Python (0) | 2020.04.14 |
[백준] 15650 : N과 M (2) - Python (0) | 2020.04.14 |
[백준] 15649 : N과 M (1) - Python (0) | 2020.04.14 |