mirror of
https://git.sb/baoshuo/OI-codes.git
synced 2024-12-28 12:31:59 +00:00
P2562 [AHOI2002]Kitty猫基因编码
R41156420
This commit is contained in:
parent
bc2208afd7
commit
38e483c67c
20
problem/P2562/P2562.cpp
Normal file
20
problem/P2562/P2562.cpp
Normal file
@ -0,0 +1,20 @@
|
||||
#include <bits/stdc++.h>
|
||||
|
||||
using namespace std;
|
||||
|
||||
string work(string s) {
|
||||
if (s.find('1') == string::npos) {
|
||||
return "A";
|
||||
}
|
||||
if (s.find('0') == string::npos) {
|
||||
return "B";
|
||||
}
|
||||
return "C" + work(s.substr(0, s.size() / 2)) + work(s.substr(s.size() / 2));
|
||||
}
|
||||
|
||||
int main() {
|
||||
string s;
|
||||
cin >> s;
|
||||
cout << work(s) << endl;
|
||||
return 0;
|
||||
}
|
Loading…
Reference in New Issue
Block a user