[20251106] BOJ / G6 / 하노이 탑 / 이준희 #1329
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/1914
🧭 풀이 시간
40분
👀 체감 난이도
✏️ 문제 설명
N개의 원판을 하노이탑 했을 때 몇회 이동해야하는지 출력하고
N이 20이하라면 그 이동경로도 출력하는 문제입니다.
🔍 풀이 방법
하노이탑 재귀를 만들어서 풀었습니다.
N이 최대 100으로 매우 큰데 하노이탑 이동 횟수는 2^N -1 이기 때문에 long으로도 안됩니다. 그래서 BigInteger 사용했습니다.
⏳ 회고
처음에 long으로 풀었는데 틀릴 수가 없는데 틀렸다 해서 열받았는데 long 범위 문제였습니다.