Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- typedef long long Int;
- Int solve(Int changes, const std::string& s) {
- std::vector<Int> count(256, 0);
- for (auto& it : s) {
- count[it]++;
- }
- Int max = *std::max_element(count.begin(), count.end());
- // сколько замен будет сделано для получения максимального результата?
- if (changes < (Int)s.size() - max) {
- return max + changes;
- } else {
- return (Int)s.size();
- }
- }
- int main() {
- std::ios_base::sync_with_stdio(false); std::cin.tie(0); std::cout.tie(0);
- Int changes;
- std::cin >> changes;
- std::string a, b, c;
- std::cin >> a >> b >> c;
- Int res1 = solve(changes, a);
- Int res2 = solve(changes, b);
- Int res3 = solve(changes, c);
- std::map<Int, Int> count;
- count[res1]++;
- count[res2]++;
- count[res3]++;
- auto max = std::max({res1, res2, res3});
- if (count[max] >= 2) {
- std::cout << "Draw";
- return 0;
- }
- std::map<Int, std::string> user;
- user[res1] = "Kuro";
- user[res2] = "Shiro";
- user[res3] = "Katie";
- std::cout << user[max];
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement