标签:format style color int inpu NPU width for global
1 count = 0 2 def hanoi(n, src, dst, mid): 3 global count 4 if n == 1: 5 print("{}:{}->{}".format(1,src,dst)) 6 count += 1 7 else : 8 hanoi(n-1, src, mid, dst) 9 print("{}:{}->{}".format(n,src,dst)) 10 count += 1 11 hanoi(n-1, mid, dst, src) 12 hanoi(eval(input()),"A","C","B") 13 print(count)
标签:format style color int inpu NPU width for global
原文地址:https://www.cnblogs.com/ghh0/p/12594151.html