mirror of
https://github.com/Kiritow/OJ-Problems-Source.git
synced 2024-03-22 13:11:29 +08:00
23 lines
312 B
C++
23 lines
312 B
C++
|
#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;
|
||
|
}
|