https://www.cnblogs.com/dmego/p/5965835.html https://blog.csdn.net/gui951753/article/details/79538799
count1
=0
def
hanoi1(n
,a
,b
,c
):
global count1
if n
==1:
print("{}->{}".format(a
,c
))
count1
+=1
else:
hanoi1(n
-1,a
,c
,b
)
print("{}->{}".format(a
,c
))
count1
+=1
hanoi1(n
-1,b
,a
,c
)
return count1
def
main():
print(hanoi1(3,"a","b","c"))
main()
转载请注明原文地址: https://lol.8miu.com/read-21315.html