Discuss / Python / 解法

解法

Topic source

pipi-hongwy

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

    if n == 1:

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

    else:

        move(n-1,a,c,b)   # a->b 将最后一个参数写成b

        move(1,a,b,c)      # a->c 将最后一个参数写成c

        move(n-1,b,a,c)   # b->c 将第一个参数写成b


  • 1

Reply