洛谷-R6691633

#include<iostream>
using namespace std;
char s[10010];
void tree(int x,int y)
{
    if(x<y)
    {
        tree(x,(x+y)/2);
        tree((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 if(s[x+i]=='0') I=0;
    if(B) cout<<"B";
    else if(I) cout<<"I";
    else cout<<"F";
}
int main()
{
    int n;
    cin>>n;
    cin>>s;
    tree(0,(1<<n)-1);
    return 0;
}

猜你喜欢

转载自blog.csdn.net/wentong_xu/article/details/79860182