#include <cstdio>
#include<iostream>
using namespace std;
long move(int, char, char,char);
int main()
{
long count;
int discCount;
cout<<"请输入汉诺塔的盘子数:";
cin>>discCount;
count=move(discCount,'A','B','C');
printf("%d个盘子需要移动%ld次\n", discCount, count);
return 0;
}
long move(int n, char A, char B,char C)
{
long c1,c2;
if(n==1)
return 1;
else
{
c1=move(n-1,A,C,B);
c2=move(n-1,B,A,C);
return c1+c2+1;
}
}