[20250218] BOJ / 골드5 / 디저트 / 설진영 #142
Merged
+48
−0
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/17953
🧭 풀이 시간
20분
👀 체감 난이도
✏️ 문제 설명
각 디저트에 대한 만족감이 각 날마다 정의되어 있고, 전날과 같은 디저트를 먹는 경우 만족감에 패널티(만족도 반감)이 있을 때, 만족감의 최대치 구하기
🔍 풀이 방법
2차원 DP 배열을 만들고, 매 날마다 각 디저트를 먹을 때 누적 최대 만족감을 구한다. 전날과 같은 디저트를 먹을 때는 만족도가 반감되는것을 고려하고 개중 최댓값을 각각 저장.
⏳ 회고
DP로 풀어야 된다는 것만 알게되면 쉽게 풀 수 있을듯. 반복문 돌릴때 인덱스 관리 잘하기