#include<iostream> #include<string> #include<bitset> #include<utility> #include<vector> #include<array> using Data = std::array<int, 11>; void print(std::array<int, 11> const& data, int data_count) { std::cout << "COUNT: " << data_count << std::endl; for (int i = 0; i<data.size(); ++i) { std::cout << data.at(i) << " "; } std::cout << std::endl; } void compare_data(Data const& fst, Data const& snd){ for (int i = 10; i>= 0; i--) { int fst_count = fst.at(i); int snd_count = snd.at(i); if (fst_count > snd_count) { std::cout << "Algosia" << std::endl; return; } else if (fst_count < snd_count) { std::cout << "Bajtek" << std::endl; return; } } std::cout << "remis" << std::endl; } void compare(Data const& fst, int fst_count, Data const& snd, int snd_count) { if (fst_count > snd_count) { std::cout << "Algosia" << std::endl; } else if (fst_count < snd_count) { std::cout << "Bajtek" << std::endl; } else { compare_data(fst, snd); } } int main() { std::array<int, 11> fst, snd; fst.fill(0); snd.fill(0); int fst_count = 0, snd_count = 0; for (int i = 0; i<18; ++i) { int tmp; std::cin >> tmp; fst_count += tmp; fst[tmp]++; } for (int i = 0; i<18; ++i) { int tmp; std::cin >> tmp; snd_count += tmp; snd[tmp]++; } compare(fst, fst_count, snd, snd_count); 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 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 | #include<iostream> #include<string> #include<bitset> #include<utility> #include<vector> #include<array> using Data = std::array<int, 11>; void print(std::array<int, 11> const& data, int data_count) { std::cout << "COUNT: " << data_count << std::endl; for (int i = 0; i<data.size(); ++i) { std::cout << data.at(i) << " "; } std::cout << std::endl; } void compare_data(Data const& fst, Data const& snd){ for (int i = 10; i>= 0; i--) { int fst_count = fst.at(i); int snd_count = snd.at(i); if (fst_count > snd_count) { std::cout << "Algosia" << std::endl; return; } else if (fst_count < snd_count) { std::cout << "Bajtek" << std::endl; return; } } std::cout << "remis" << std::endl; } void compare(Data const& fst, int fst_count, Data const& snd, int snd_count) { if (fst_count > snd_count) { std::cout << "Algosia" << std::endl; } else if (fst_count < snd_count) { std::cout << "Bajtek" << std::endl; } else { compare_data(fst, snd); } } int main() { std::array<int, 11> fst, snd; fst.fill(0); snd.fill(0); int fst_count = 0, snd_count = 0; for (int i = 0; i<18; ++i) { int tmp; std::cin >> tmp; fst_count += tmp; fst[tmp]++; } for (int i = 0; i<18; ++i) { int tmp; std::cin >> tmp; snd_count += tmp; snd[tmp]++; } compare(fst, fst_count, snd, snd_count); return 0; } |