摘要:
汉诺塔问题:有3根杆子A, B, C。A杆上有N个(N>1)穿孔圆盘,盘的尺寸由下到上依次变小。按如下规则将所有圆盘移至C杆:每次只能移动一个圆盘;大盘不能叠在小盘上面。问如何移动次数最少?#include <iostream>void move(x, y) { std::cout << x << " -> " << y << std::endl;}void hanoi(unsigned int n, char a, char b, char c) { if (n == 1) { move(a, c); 阅读全文