[20251104] BOJ / G4 / 토끼가 정보섬에 올라온 이유 / 권혁준 #1316
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/17130
🧭 풀이 시간
5분
👀 체감 난이도
✏️ 문제 설명
N*M 격자에 토끼 한 마리가 살고 있다.
격자의 각 칸은 빈 칸, 벽, 당근, 쪽문 중 하나로 구성되어 있다.
토끼는 →, ↘, ↗ 방향으로만 이동하며, 가는 길에 당근을 최대한 많이 주워서 쪽문으로 탈출하려 한다.
탈출할 수 있다면, 그 때 얻을 수 있는 당근의 최대 개수를 구해보자.
🔍 풀이 방법
2차원 DP로 이전 세 방향에서의 결과값을 현재 칸에 반영하도록 점화식을 세워 해결했다.
지날 수 없는 칸에 대해서는 -1로 따로 처리해줬다.
⏳ 회고
ez