Problem
https://www.acmicpc.net/problem/11729
Solution
code
1
2
3
4
5
6
7
8
9
10
11
12
def hanoi(n, before, after) :
if n == 1 :
print(before, after)
return
hanoi(n-1, before, 6-before-after) # 1단계
print(before, after) # 2단계
hanoi(n-1, 6-before-after, after) # 3단계
n = int(input())
print(2**n - 1)
hanoi(n, 1, 3)