Discuss / Python / 我的解法

我的解法

Topic source

 def move(n, a, b, c):

...     if n == 1:

...         print(a, '-->', c)

...     else:

...         move(n-1,a, c, b)

...         move(1, a, b, c)

...         move(n-1, b, a, c)

不用管别的东西, 只关心n和n-1之间怎么递推, 和极限情况下怎么运行, 再合起来就行了.

✎ @#*

#2 Created at ... [Delete] [Delete and Lock User]

666,好像是这么个理


  • 1

Reply