20200421 3문제
2447 11729 2447_loop (add 뭔가 2447이 이상함 다시 풀어야겠음)
This commit is contained in:
14
zeta_python/completed/11729.py
Normal file
14
zeta_python/completed/11729.py
Normal file
@@ -0,0 +1,14 @@
|
||||
N = int(input())
|
||||
def move(f, t):
|
||||
print(f, t)
|
||||
|
||||
def hanoi(n, f, b, t):
|
||||
if n == 1:
|
||||
move(f, t)
|
||||
else:
|
||||
hanoi(n-1, f, t, b)
|
||||
move(f, t)
|
||||
hanoi(n-1, b, f, t)
|
||||
|
||||
print(2**N-1)
|
||||
hanoi(N, 1,2,3)
|
||||
Reference in New Issue
Block a user