P200汉诺塔
#include<bits/stdc++.h>
using namespace std;
int main()
{
int n,i;
long long s[40];
s[1]=2;
for(i=2;i<=35;i++)
s[i]=3*s[i-1]+2;
while(cin>>n)
...
public class Hanoi {
public static void main(String[] args ) {
Hanoi hanoi = new Hanoi();
hanoi.hanoi(8,'a','b','c');
}
//圆盘个数,三根柱子,作为参数
public void ...
目录
1 问题描述
2 解决方案
2.1 递归法
2.2 非递归法
1 问题描述
Simulate the movement of the Towers of Hanoi Puzzle; Bonus is possible for using animation.
e.g. if n = 2 ; A→B ; A→...