#include <iostream> #include <vector> #include <algorithm> #include <numeric> std::vector<int> load() { std::vector<int> v(18); for (int& vv : v) std::cin >> vv; v.push_back(std::accumulate(v.begin(), v.end(), 0)); std::sort(v.rbegin(), v.rend()); return v; } int main() { std::ios_base::sync_with_stdio(0); auto a = load(); auto b = load(); if (b < a) std::cout << "Algosia" << std::endl; else if (a < b) std::cout << "Bajtek" << std::endl; else std::cout << "remis" << std::endl; return 0; }
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | #include <iostream> #include <vector> #include <algorithm> #include <numeric> std::vector<int> load() { std::vector<int> v(18); for (int& vv : v) std::cin >> vv; v.push_back(std::accumulate(v.begin(), v.end(), 0)); std::sort(v.rbegin(), v.rend()); return v; } int main() { std::ios_base::sync_with_stdio(0); auto a = load(); auto b = load(); if (b < a) std::cout << "Algosia" << std::endl; else if (a < b) std::cout << "Bajtek" << std::endl; else std::cout << "remis" << std::endl; return 0; } |