from itertools import combinations
N, M = map(int, input().split())
p = combinations(range(1, N+1), M)
for i in p:
print(i)
중복이 안되므로 combinations으로 풀어 준다.
'개발 > Algorithm' 카테고리의 다른 글
[Python] 백준 9093번 단어 뒤집기 (0) | 2021.11.15 |
---|---|
[Python] 백준 14720번 우유 축제 (0) | 2021.11.15 |
[Python] 백준 15649번 N과 M (1) (0) | 2021.11.15 |
[Python] 백준 1260번 DFS와 BFS (0) | 2021.11.12 |
[Python] 백준 10814번 나이순 정렬 (0) | 2021.11.11 |
댓글