[20251007] BOJ / G4 / 우유 도시 / 한종욱 #1060
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/14722
🧭 풀이 시간
60분
👀 체감 난이도
✏️ 문제 설명
오른쪽 또는 아래로만 이동가능하고, 정해진 순서대로 우유를 먹을 때 제일 많은 우유를 먹을 수 있는 개수는?
🔍 풀이 방법
dp[i][j][k] = (i, j)에 도착했을 때, 마지막으로 마신 우유가 k인 경우의 최대 우유 개수로 상태정의를 한다.으로 경우의 수를 나눈 뒤, 갱신
이 때, 초기화도 잘해줘야 한다.
⏳ 회고
내가 틀린 이유는 상태정의를 마지막으로 마신 우유가 아닌 현재 위치의 우유로 생각하고 풀었기 때문이다. 상태정의를 잘못했기 때문에 이후 로직이 맞았어도 틀린 로직이었다.