def hanoi(n,a,b,c): if n==1: print(n,a+'->'+c) else: hanoi(n-1,a,c,b) print(n,a+'->'+c) hanoi(n-1,b,a,c)hanoi(4,'A','B','C')
本文共 223 字,大约阅读时间需要 1 分钟。
def hanoi(n,a,b,c): if n==1: print(n,a+'->'+c) else: hanoi(n-1,a,c,b) print(n,a+'->'+c) hanoi(n-1,b,a,c)hanoi(4,'A','B','C')
转载于:https://www.cnblogs.com/guangzhoushangxueyuan/p/9179929.html