#include<iostream>
#include<stdio.h>
using namespace std;
void hannuo(int n,char start,char transfer,char end)
{
if(n==0)
{
}
else
{
hannuo(n-1,start,end,transfer);
printf("%c-->%c\n",start,end);
hannuo(n-1,transfer,start,end);
}
}
int main()
{
ios::sync_with_stdio(false);cin.tie(0);
hannuo(3,'x','y','z');
return 0;
}
汉诺塔
最新推荐文章于 2019-09-04 20:28:39 发布