#include <iostream> #include <vector> #include <sstream> // Include this header for stringstream using namespace std; int main() { std::ios_base::sync_with_stdio(false); std::cin.tie(NULL); vector<int> alg; vector<int> baj; // Input string input; getline(cin, input); stringstream ss(input); int num; while (ss >> num) { alg.push_back(num); } getline(cin, input); stringstream ss2(input); while (ss2 >> num) { baj.push_back(num); } // Processing int sum_alg = 0, sum_baj = 0; vector<int> algs(11, 0); vector<int> bajts(11, 0); for (size_t i = 0; i < alg.size(); ++i) { sum_alg += alg[i]; sum_baj += baj[i]; algs[alg[i]] += 1; bajts[baj[i]] += 1; } // Output if (sum_alg > sum_baj) { cout << "Algosia" << "\n"; } else if (sum_baj > sum_alg) { cout << "Bajtek" << "\n"; } else { for (int i = 10; i > 0; --i) { if (algs[i] > bajts[i]) { cout << "Algosia" << "\n"; return 0; } else if (bajts[i] > algs[i]) { cout << "Bajtek" << "\n"; return 0; } } cout << "remis" << "\n"; } return 0; }
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 | #include <iostream> #include <vector> #include <sstream> // Include this header for stringstream using namespace std; int main() { std::ios_base::sync_with_stdio(false); std::cin.tie(NULL); vector<int> alg; vector<int> baj; // Input string input; getline(cin, input); stringstream ss(input); int num; while (ss >> num) { alg.push_back(num); } getline(cin, input); stringstream ss2(input); while (ss2 >> num) { baj.push_back(num); } // Processing int sum_alg = 0, sum_baj = 0; vector<int> algs(11, 0); vector<int> bajts(11, 0); for (size_t i = 0; i < alg.size(); ++i) { sum_alg += alg[i]; sum_baj += baj[i]; algs[alg[i]] += 1; bajts[baj[i]] += 1; } // Output if (sum_alg > sum_baj) { cout << "Algosia" << "\n"; } else if (sum_baj > sum_alg) { cout << "Bajtek" << "\n"; } else { for (int i = 10; i > 0; --i) { if (algs[i] > bajts[i]) { cout << "Algosia" << "\n"; return 0; } else if (bajts[i] > algs[i]) { cout << "Bajtek" << "\n"; return 0; } } cout << "remis" << "\n"; } return 0; } |