# n, m
n, m = map(int, input().split())
# 함수들
# print_ans()
def print_ans():
for a in ans:
print(a, end=' ')
print()
# make_comb(curr_idx)
def make_comb(curr_idx):
# 종료조건
if curr_idx == m+1:
print_ans()
return
# 숫자 넣어주기
for i in range(1, n+1):
# 오름차순으로 만들기
if curr_idx >= 2 and ans[-1] >= i:
continue
else:
ans.append(i)
make_comb(curr_idx + 1)
ans.pop()
# 설계
# ans
ans = []
# make_comb
make_comb(1)
'Algorithm(CodeTree, Python) > Backtracking' 카테고리의 다른 글
[코드트리] xor 결과 최대 만들기 Python (0) | 2023.02.02 |
---|---|
[코드트리] 단순한 동전 챙기기 Python (0) | 2023.02.01 |
[코드트리] 1차원 윷놀이 Python (0) | 2023.01.31 |
[코드트리] 최소 점프 횟수 Python (0) | 2023.01.31 |
[코드트리] 특정 조건에 맞게 k개 중에 1개를 n번 뽑기 Python (0) | 2023.01.30 |