#include <iostream>
using namespace std;
int r=0;
void move(char x,char y)
{
cout<<x<<"-->"<<y<<endl;
}
void hanoi(int n,char one,char two,char three)
{
if(n==1)
{
move(one,three);
r++;
}
else
{
hanoi(n-1,one,three,two);
move(one,three);r++;
hanoi(n-1,two,one,three);
}
}
void main()
{
int n;
cout<<"请输入盘子数:";
cin>>n;
cout<<"各步骤如下:"<<endl;
hanoi(n,'A','B','C');
cout<<"总步骤数为:"<<r<<endl;
}