Create 1870.cpp

This commit is contained in:
Kirigaya Kazuto 2016-10-24 17:06:43 +08:00 committed by GitHub
parent 8b8404ed3a
commit 5bdf456d2f

22
QUSTOJ/1870.cpp Normal file
View File

@ -0,0 +1,22 @@
#include <iostream>
using namespace std;
void act(int n,char a,char b,char c)
{
if(n==1)
cout<<a<<"---->"<<c<<endl;
else
{
act(n-1,a,c,b);
cout<<a<<"---->"<<c<<endl;
act(n-1,b,a,c);
}
}
int main()
{
int n;
cin>>n;
act(n,'A','B','C');
return 0;
}