Run ID | 作者 | 问题 | 语言 | 测评结果 | 分数 | 时间 | 内存 | 代码长度 | 提交时间 |
---|---|---|---|---|---|---|---|---|---|
99648 | 陈志轩 | FBI树 | C++ | 通过 | 100 | 0 MS | 260 KB | 602 | 2023-08-23 14:43:14 |
#include<iostream> #include<string> #include<cmath> using namespace std; string s; void FBI(int x,int y){ if (y > x){ FBI(x,(x + y) / 2); FBI((x + y) / 2 + 1,y); } bool B = true,I = true; for (int i = x;i <= y;i++){ if (s[i] == '1'){ B = false; } if (s[i] == '0'){ I = false; } } if (B){ cout<<"B"; } else if (I){ cout<<"I"; } else{ cout<<"F"; } } int main(){ int n; cin>>n>>s; FBI(0,pow(2,n) - 1); return 0; }