| Run ID | 作者 | 问题 | 语言 | 测评结果 | 时间 | 内存 | 代码长度 | 提交时间 |
|---|---|---|---|---|---|---|---|---|
| 81261 | sh25_wangsj | FBI树 | C++ | 通过 | 0 MS | 248 KB | 708 | 2026-01-04 15:43:40 |
#include<bits/stdc++.h> using namespace std; string s; int leixing(int l,int r){ int a=0,b=0; for(int i=l;i<=r;++i){ if(s[i]=='0'){ a++; }else{ b++; } } if(a!=0&&b!=0){ return 0; }else if(b==0){ return 1; }else{ return 2; } }//F:0 B:1 I:2 void f(int l,int r){ if(l==r){ int x=leixing(l,r); if(x==0){ cout<<'F'; }else if(x==1){ cout<<'B'; }else{ cout<<'I'; } return; } int x=leixing(l,r); int mid=(l+r+1)/2; f(l,mid-1); f(mid,r); if(x==0){ cout<<'F'; }else if(x==1){ cout<<'B'; }else{ cout<<'I'; } return; } int main(){ int aa; cin>>aa; s=getchar(); cin>>s; f(0,s.length()-1); return 0; }