Notice
Recent Posts
Recent Comments
Link
HwangHub
[백준 / python] # 15652 N과 M(4) 본문
중복 조합을 이용하여 출력을 하는 문제이다. 앞서 학습한 순열과 조합 문제들과 비슷한 문제라고 생각하면 된다.
정답 코드
from itertools import combinations_with_replacement as cbwr
n, m = map(int, input().split())
arr = [i for i in range(1, n+1)]
for x in cbwr(arr, m):
print(' '.join(map(str, x)))
'workspace > 알고리즘' 카테고리의 다른 글
[백준 / python] #11880 개미 (0) | 2023.02.12 |
---|---|
[백준/python] #2309 일곱 난쟁이 (0) | 2023.02.12 |
[백준 / Python] #1718. 암호 (0) | 2023.02.07 |
[백준 / python] #15820 맞았는데 왜 틀리죠? (0) | 2023.02.05 |
[백준 / Python] #7795 먹을 것인가 먹힐 것인가 (0) | 2023.02.02 |
Comments