반응형
# @Author YoungMinKim
# baekjoon
def hanoi_tower(n,fr,tmp,to):
if n == 1:
print(fr,to)
else:
hanoi_tower(n-1,fr,to,tmp)
print(fr,to)
hanoi_tower(n-1,tmp,fr,to)
N=int(input())
print((2**N)-1)
hanoi_tower(N,1,2,3)
반응형
'백준 문제풀이' 카테고리의 다른 글
baekjoon - python - 2164 (0) | 2020.09.13 |
---|---|
baekjoon - python - 11942 (0) | 2020.09.13 |
baekjoon - python - 11721 (0) | 2020.09.13 |
baekjoon - python - 11720 (0) | 2020.09.13 |
baekjoon - python - 11719 (0) | 2020.09.13 |
댓글