[20250902] BOJ / G5 / 동전 2 / 이강현 #803
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/2294
🧭 풀이 시간
30분
👀 체감 난이도
✏️ 문제 설명
동전이 n개 있다.
동전을 여러개 사용하여 k원을 만드는데 필요한 동전의 최소 개수를 출력.
각각의 동전은 여러개 사용할 수 있다.
🔍 풀이 방법
dp
각각의 동전에 대해서 그 동전 금액을 뺀 곳에서 +1을 하는 경우와 현재 최소 개수와 비교하여 최소 개수를 반영하는 것을 반복
⏳ 회고
동전 금액을 뺀 곳이 유효하지 않은지 생각하는 것을 놓쳤다.
각각의 동전들을 고려하는 방식인데, 이전까지의 동전들을 모두 고려해서 i원을 만들 수 없다면, i원에서 오는 경우는 고려하지 않아야 한다.
알고리즘은 왜 하루 이틀전에 푼 유형만 기억이 날까.....