标签:一个 div lse class 汉诺塔 put span int inpu
1 num = int(input("请输入A的方块个数:")) 2 def hanoi(num,a,b,c): 3 if num==1: 4 print(a,">>>",c) 5 6 else: 7 hanoi(num-1,a,c,b) #n-1个方块从A移动到B 8 hanoi(1,a,b,c) #最后一个方块从A移动到C 9 hanoi(num-1,b,a,c) #n-1个方块从B移动到C 10 hanoi(num,"A","B","C")
标签:一个 div lse class 汉诺塔 put span int inpu
原文地址:https://www.cnblogs.com/NoteBook3013/p/10187487.html