[20250805] BOJ / G5 / 소수 화폐 / 이종환 #613
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
🧷 문제 링크
https://www.acmicpc.net/problem/16400
🧭 풀이 시간
20분
👀 체감 난이도
✏️ 문제 설명
소수나라는 특이하게 모든 소수(prime number)를 화폐 단위로 사용한다.
물건을 구매하려던 하나는 소수나라의 화폐를 이용하여 N원을 정확히 만들 수 있는 방법의 가짓수가 얼마나 되는지 궁금해졌다.
하나를 도와 N원을 지불하기 위한 가짓수가 얼마나 되는지 구해보자.
단, 하나는 소수나라의 모든 화폐가 무한정 있다고 가정한다.
🔍 풀이 방법
에라스토테네스의 체 + dp를 하면 간단히 풀 수 있다. 이때 화폐를 무제한으로 쓸 수 있다고 하였기에 0 to target으로 순회를 하였다.
⏳ 회고
어제 왜 pr안갔지...