# There is only one problem to solve——汉诺塔问题

声明: 本文为0xBBC原创, 转载注明出处喵～

## 2 thoughts on “There is only one problem to solve——汉诺塔问题”

1. Night Fury说道：

在啃严奶奶的数据结构，用python跑了下：

s = 0
def hanoi(n,x,y,z):
if n==1:
move(x,1,z)
else:
hanoi(n-1,x,z,y)
move(x,n,z)
hanoi(n-1,y,x,z)
def move(x,n,z):
global s
s = s + 1
print("Move disk " + str(n) + " from "+ x + " to " + z)
print("Step " + s)

hanoi(3,"a","b","c")

1. 0xBBC说道：

呜哇，帮你加上了pre标签ω