mirror of
https://github.com/Kiritow/OJ-Problems-Source.git
synced 2024-03-22 13:11:29 +08:00
Create 1870.cpp
This commit is contained in:
parent
8b8404ed3a
commit
5bdf456d2f
22
QUSTOJ/1870.cpp
Normal file
22
QUSTOJ/1870.cpp
Normal 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;
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user