You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
|
|
#include <bits/stdc++.h>
|
|
|
|
|
|
|
|
|
|
using namespace std;
|
|
|
|
|
|
|
|
|
|
//声明FBI函数
|
|
|
|
|
char FBI(string s);
|
|
|
|
|
|
|
|
|
|
int main() {
|
|
|
|
|
int n;
|
|
|
|
|
cin >> n;
|
|
|
|
|
string s;
|
|
|
|
|
cin >> s;
|
|
|
|
|
cout << FBI(s);
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//FBI函数(递归函数)的实现
|
|
|
|
|
char FBI(string s) {
|
|
|
|
|
if (s.length() > 1) {
|
|
|
|
|
//输出左
|
|
|
|
|
cout << FBI(s.substr(0, s.length() / 2));
|
|
|
|
|
//输出右
|
|
|
|
|
cout << FBI(s.substr(s.length() / 2, s.length() / 2));
|
|
|
|
|
}
|
|
|
|
|
// http://c.biancheng.net/view/400.html
|
|
|
|
|
if (s == string(s.length(), '0')) return 'B'; //通过string的构造函数,构建s.length()长度的0组成的字符串
|
|
|
|
|
if (s == string(s.length(), '1')) return 'I';
|
|
|
|
|
//混搭的输出F
|
|
|
|
|
return 'F';
|
|
|
|
|
}
|