#include <iostream> constexpr int N = 18; constexpr int P = 11; int A[N], B[N]; int A_bucket[P], B_bucket[P]; int a_score = 0, b_score = 0; int main() { for (int i = 0; i < N; ++i) { std::cin >> A[i]; ++A_bucket[A[i]]; a_score += A[i]; } for (int i = 0; i < N; ++i) { std::cin >> B[i]; ++B_bucket[B[i]]; b_score += B[i]; } if (a_score > b_score) { std::cout << "Algosia"; return 0; } else if (b_score > a_score) { std::cout << "Bajtek"; return 0; } for (int i = P - 1; i >= 0; --i) { if (A_bucket[i] > B_bucket[i]) { std::cout << "Algosia"; return 0; } else if (B_bucket[i] > A_bucket[i]) { std::cout << "Bajtek"; return 0; } } std::cout << "remis"; 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 | #include <iostream> constexpr int N = 18; constexpr int P = 11; int A[N], B[N]; int A_bucket[P], B_bucket[P]; int a_score = 0, b_score = 0; int main() { for (int i = 0; i < N; ++i) { std::cin >> A[i]; ++A_bucket[A[i]]; a_score += A[i]; } for (int i = 0; i < N; ++i) { std::cin >> B[i]; ++B_bucket[B[i]]; b_score += B[i]; } if (a_score > b_score) { std::cout << "Algosia"; return 0; } else if (b_score > a_score) { std::cout << "Bajtek"; return 0; } for (int i = P - 1; i >= 0; --i) { if (A_bucket[i] > B_bucket[i]) { std::cout << "Algosia"; return 0; } else if (B_bucket[i] > A_bucket[i]) { std::cout << "Bajtek"; return 0; } } std::cout << "remis"; return 0; } |