1 条题解
-
-1
和FBI树很像
#include<bits/stdc++.h> using namespace std; int n; string a; char dfs(int h,int t) { //cout<<k<<endl; if(t-h>=1) { int s=0,k=0; for(int i=h;i<=t;i++) s=s+a[i]-48,k++; if(s==0)cout<<"A"; else if(s==k)cout<<"B"; else { cout<<"C"; dfs(h,(t-h)/2+h); dfs((t-h)/2+h+1,t); } } else { if(a[h]=='1')cout<<"B"; else cout<<"A"; } } int main() { cin>>a; dfs(0,a.size()-1); }
- 1
信息
- ID
- 86
- 时间
- 1000ms
- 内存
- 256MiB
- 难度
- 2
- 标签
- (无)
- 递交数
- 29
- 已通过
- 22
- 上传者