[20251015] PGM / Lv2 / 점프와 순간 이동 / 이강현 #1127
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://school.programmers.co.kr/learn/courses/30/lessons/12980
🧭 풀이 시간
10분
👀 체감 난이도
✏️ 문제 설명
N까지 갈거임.
근데 K만큼 이동한다고 가정하면 K가 드는데 그동안 왔던 거리의 두배를 이동하는 것은 꽁짜임.
최소 비응으로 N에 도달할때 비용 출력.
🔍 풀이 방법
순간이동을 무조건 많이쓰는게 이득임.
결국 N부터 2로 나누어 떨어지면 꽁짜고 아니면 1을 이동했다고 가정하고 비용을 1 증가시키고 1을 뺀 후 다시 나누는 과정을 반복.
⏳ 회고
그냥 감으로 이렇게 하면 될 것 같아서 했는데,
왜 이게 최적인지 명확하게 팍 오는게 아니어서 애매하다.
순간이동이 꽁짜니까 매 순간 1순위로 사용한다는 것을 보면 이해는 되는데, 뭔가 찜찜하달까..