在我眼中不完美的汉诺塔
#! -*- coding:utf-8 -*-
#Author:sjf
#QQ:1186777415
#Version1.1
n = int(input('请输入您想要的层数:'))
def hanuo(n,x,y,z):
if n == 1:
print(x ,'-->', z)
else:
hanuo(n-1, x, z, y)
print(x , '-->',z)
hanuo(n-1, y, x, z)
hanuo(n,'x','y','z')
print('总共执行了%d次'% (2**n -1))