하노이1 [python]재귀 - 하노이의 탑 [참고 블로그] shoark7.github.io/programming/algorithm/tower-of-hanoi '하노이의 탑' 이해하기 '하노이의 탑' 문제를 이해하고 문제 해결을 위한 핵심 통찰을 살핀 뒤 코드로 작성합니다. 이후 탑의 개수에 따른 총 이동 횟수를 구하는 일반항까지 수학적으로 유도합니다. shoark7.github.io [코드] # 하노이의 탑 경로출력 - 출처 : https://shoark7.github.io/programming/algorithm/tower-of-hanoi MSG_FORMAT = "{}: {} -> {}" def move(N, start, to): print(MSG_FORMAT.format(N, start, to)) def hanoi(N, start, to, vi.. 2021. 4. 24. 이전 1 다음