[20251209] BOJ / G5 / 김밥천국의 계단 / 이강현 #1623
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/28069
🧭 풀이 시간
60분
👀 체감 난이도
✏️ 문제 설명
0번째부터 N번째 계단이 있음.
K번의 행동을 통해 N번째 계단에 가야함.
행동은 두가지가 있음.
한칸가기와 현재칸 + 현재칸/2로 가기임.
갈 수 있는지 없는지 여부를 체크
🔍 풀이 방법
BFS
⏳ 회고
구현된 것을 보면 그냥 BFS였다.
근데 K번에 정확히 N으로 도달해야한다는 점에 너무 매몰되어서
현재 칸에 몇개의 행동으로 갔는지를 저장해야한다고 생각했다.
하지만 K번째보다 적게만 갈 수 있다면, 0번째에서 0번째로 갈 수 있는 행동이 있기때문에
K번에 딱 그 자리로 갈 수 있게된다.
행동을 한 후에 자기자신이 될 수 있다면, 정확히 K번에 맞춰야하는 문제는 K이하로 갈 수 있는지로 바뀔 수 있다는 것을 배웠다.