[Python]代码
# -*- coding: utf-8 -*- def move(n, A, B, C): if n <= 0: return if n == 1: print('move', A, '#1--------->', C) return if n == 2: print('move', A, '#1--------->', B) print('move', A, '#2--------->', C) print('move', B, '#1--------->', C) return move(n-1, A, C, B) print('move', A, '#%d'%n, '-------->', C) move(n-1, B, A, C) move(5, 'A', 'B', 'C')
原创文章,作者:Maggie-Hunter,如若转载,请注明出处:https://blog.ytso.com/8117.html