P1087 FBI树
#include <iostream>
using namespace std;
char s[1024];
void makeTree(int x,int y){
if(y>x){
makeTree(x,(x+y)/2);
makeTree((x+y+1)/2,y);
}
int B=1,I=1;
for(int i=0;i<=y-x;i++){
if(s[x+i]=='1'){
B=0;
} else{
I=0;
}
}
if(B){
cout<<'B';
}
else if(I){
cout<<'I';
}
else{
cout<<'F';
}
}
int main(){
int n;
cin>>n;
cin>>s;
makeTree(0,(1<<n)-1);
return 0;
}