P1087 FBI树
#include <bits/stdc++.h>
using namespace std;
int n;
char s[1025];
int Build(int l,int r){
int mid = (l + r) >> 1;
if(l != r){
Build(l,mid);
Build(mid + 1,r);
}
int a = 0, b = 0;
for(int i = l;i <= r;i++){
if(s[i] == '0')
a++;
else b++;
}
if(a && b)
cout << "F";
else if(a)
cout <<"B";
else
cout <<"I";
}
int main(){
scanf("%d",&n);
scanf("%s",s+1);
Build(1,(int)pow(2,n));
return 0;
}