시리즈에 맞게 역시 itertools의 combinations_With_Replacement (중복조합)을 이용하면 되는 문제
이 itertools에 관련된 총 정리글을 조만간 게시글에 올려봐야겠다.
from itertools import combinations_with_replacement
n, m = map(int, input().split())
data = [i for i in range(1, n + 1)]
for i in combinations_with_replacement(data, m):
for j in i:
print(j, end=' ')
print()
'백준 알고리즘 (Baekjoon Algorithm)' 카테고리의 다른 글
[파이썬] 백준 알고리즘 No.5430 AC (0) | 2021.12.16 |
---|---|
[파이썬] 백준 알고리즘 No.17298 오큰수 (0) | 2021.12.16 |
[파이썬] 백준 알고리즘 No.15651 N과 M (3) (0) | 2021.12.15 |
[파이썬] 백준 알고리즘 No.15650 N과 M(2) (0) | 2021.12.15 |
[파이썬] 백준 알고리즘 No.1002 터렛 (0) | 2021.12.14 |