Conversation
점화식 유도
dp[i] = i번째 계단까지 올라섰을 때 얻을 수 있는 최대 점수
1. 마지막 계단(i)은 반드시 밟아야 한다.
2. 두 가지 경우가 있음:
i-2 → i (한 칸 건너뛰고 오름)
dp[i-2] + score[i]
i-3 → i-1 → i (중간에 한 계단을 밟음, 3연속 방지)
dp[i-3] + score[i-1] + score[i]
yu-heejin
approved these changes
Aug 17, 2025
Collaborator
There was a problem hiding this comment.
중요한건 아니지만 BufferedReader를 사용하면 조금 더 빠릅니다!
Collaborator
|
잘 봤습니다~!! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
점화식 유도
dp[i] = i번째 계단까지 올라섰을 때 얻을 수 있는 최대 점수
마지막 계단(i)은 반드시 밟아야 한다.
두 가지 경우가 있음: i-2 → i (한 칸 건너뛰고 오름) dp[i-2] + score[i]
i-3 → i-1 → i (중간에 한 계단을 밟음, 3연속 방지)
dp[i-3] + score[i-1] + score[i]