#include <iostream> using namespace std; int main() { int points[11]; int n = 18; for (int i = 0; i < 11; i++) { points[i] = 0; } int alg_sum = 0; for (int i = 0; i < n; i++) { int x; cin >> x; points[x]++; alg_sum += x; } int bajt_sum = 0; for (int i = 0; i < n; i++) { int x; cin >> x; points[x]--; bajt_sum += x; } if (alg_sum > bajt_sum) { cout << "Algosia" << endl; return 0; } else if (alg_sum < bajt_sum) { cout << "Bajtek" << endl; return 0; } else { for (int i = 11; i >= 0; --i) { if (points[i] < 0) { cout << "Bajtek" << endl; return 0; } if (points[i] > 0) { cout << "Algosia" << endl; return 0; } } } cout << "remis" << 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 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> using namespace std; int main() { int points[11]; int n = 18; for (int i = 0; i < 11; i++) { points[i] = 0; } int alg_sum = 0; for (int i = 0; i < n; i++) { int x; cin >> x; points[x]++; alg_sum += x; } int bajt_sum = 0; for (int i = 0; i < n; i++) { int x; cin >> x; points[x]--; bajt_sum += x; } if (alg_sum > bajt_sum) { cout << "Algosia" << endl; return 0; } else if (alg_sum < bajt_sum) { cout << "Bajtek" << endl; return 0; } else { for (int i = 11; i >= 0; --i) { if (points[i] < 0) { cout << "Bajtek" << endl; return 0; } if (points[i] > 0) { cout << "Algosia" << endl; return 0; } } } cout << "remis" << endl; return 0; } |