문제 링크: https://www.acmicpc.net/problem/15652
백준 알고리즘 기초 2/2 510에서 4번째 - 15652번 N과 M (4)를 풀어보았다.
풀이:
파이썬의 경우 combinations_with_replacement을 이용했다.
C++
Python
from itertools import combinations_with_replacement
n,m=map(int,input().split())
arr=[i+1 for i in range(n)]
res=combinations_with_replacement(arr,m)
for i in res:
for j in i:
print(j,end=' ')
print()
Java
'코테용 문제풀이 > 백준' 카테고리의 다른 글
N과 M (6) 풀이 (0) | 2023.01.24 |
---|---|
N과 M (5) 풀이 (0) | 2023.01.24 |
N과 M (3) 풀이 (0) | 2023.01.24 |
N과 M (2) 풀이 (0) | 2023.01.24 |
N과 M (1) 풀이 (0) | 2023.01.24 |