def hanoi(n, a, b, c): if n > 0: hanoi(n - 1, a, c, b) print('%s->%s' % (a, c)) hanoi(n - 1, b, a, c) hanoi(2, "A", "B", "C")
def hanoi(n, a, b, c): if n > 0: hanoi(n - 1, a, c, b) print('%s->%s' % (a, c)) hanoi(n - 1, b, a, c) hanoi(2, "A", "B", "C")
转载于:https://www.cnblogs.com/ls1997/p/10931336.html