#include <iostream> #include <array> #include <compare> using namespace std; int main() { array<int, 12> a{}, b{}; for (int i = 0; i < 18; ++i) { int r; cin >> r; ++a[r]; a[11] += r; } for (int i = 0; i < 18; ++i) { int r; cin >> r; ++b[r]; b[11] += r; } for (int i = 11; i > 0; --i) { auto res = a[i] <=> b[i]; if (res > 0) { cout << "Algosia"; return 0; } if (res < 0) { cout << "Bajtek"; return 0; } } cout << "remis"; }
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 | #include <iostream> #include <array> #include <compare> using namespace std; int main() { array<int, 12> a{}, b{}; for (int i = 0; i < 18; ++i) { int r; cin >> r; ++a[r]; a[11] += r; } for (int i = 0; i < 18; ++i) { int r; cin >> r; ++b[r]; b[11] += r; } for (int i = 11; i > 0; --i) { auto res = a[i] <=> b[i]; if (res > 0) { cout << "Algosia"; return 0; } if (res < 0) { cout << "Bajtek"; return 0; } } cout << "remis"; } |