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)
原文地址:https://www.cnblogs.com/fkfkfk/p/9180155.html
时间: 2024-11-09 00:31:15
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)
原文地址:https://www.cnblogs.com/fkfkfk/p/9180155.html