提交时间:2023-08-23 16:10:31

运行 ID: 99709

#include <bits/stdc++.h> using namespace std; int n; string s; void dfs(int l, int r) { int mid = (l+r)/2; if(l!=r) { dfs(l,mid); dfs(mid+1,r); } int sum = 0; for(int i = l; i <= r; i++) { if(s[i]=='1')sum++; } if(sum==r-l+1) { cout << "I"; } else if(sum==0) { cout << "B"; } else { cout << "F"; } } signed main() { cin >> n; cin >> s; dfs(0,s.length()-1); return 0; }