c
FBI树
http://www.nowcoder.com/questionTerminal/ba4eaca758f742be98b6967f12ecbdc8
include
include
using namespace std;
char s[(1<<10)+10];
int work(int l,int r)
{
if(l==r)
{
if(s[l]=='0') cout<<"B";
else cout<<"I";
return s[l]=='1';
}
int sl,sr,m=(l+r)/2;
sl=work(l,m);
sr=work(m+1,r);
if(sl+sr==0)
{
cout<<"B";
return 0;
}
else if(sl+sr==2)
{
cout<<"I";
return 1;
}
else
{
cout<<"F";
return 3;
}
}
int main()
{
cin>>s>>s;
work(0,strlen(s)-1);
return 0;
}