0
已解决
刘乐宸
新手天翼
新手天翼
为什么会MLE嫩?
#include <iostream>
using namespace std;
int N;
void f(int n, char a, char b, char c) {
if(n==0) return ;
f(n-1, a,c, b);
cout << a << "->" << b << endl;
cout << a << "->" << b << endl;
f(n-1, c, b, a);
}
void h(int n){
if(n==1){
cout<<"A->C"<<endl;
cout<<"A->B"<<endl;
}
f(n-1,'A','B','C');
cout<<"A->C"<<endl;
cout<<"A->C"<<endl;
f(n-1,'B','A','C');
cout<<"C->B"<<endl;
h(n-1);
}
int main() {
cin>>N;
N/=2;
h(N);
return 0;
}