#include <bits/stdc++.h> using namespace std; using ll = long long; int a[18]; int b[18]; int main() { cin.tie(0); ios_base::sync_with_stdio(false); ll sum_a = 0; ll sum_b = 0; int n = 18; for (int i = 0; i < n; i++) { cin >> a[i]; sum_a += a[i]; } for (int i = 0; i < n; i++) { cin >> b[i]; sum_b += b[i]; } if (sum_a > sum_b) { cout << "Algosia\n"; return 0; } else if (sum_b > sum_a) { cout << "Bajtek\n"; return 0; } else { sort(a, a+n); sort(b, b+n); for (int i = 17; i >= 0; i--) { if (a[i] > b[i]) { cout << "Algosia\n"; return 0; } else if (a[i] < b[i]) { cout << "Bajtek\n"; return 0; } } } cout << "remis\n"; }
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 | #include <bits/stdc++.h> using namespace std; using ll = long long; int a[18]; int b[18]; int main() { cin.tie(0); ios_base::sync_with_stdio(false); ll sum_a = 0; ll sum_b = 0; int n = 18; for (int i = 0; i < n; i++) { cin >> a[i]; sum_a += a[i]; } for (int i = 0; i < n; i++) { cin >> b[i]; sum_b += b[i]; } if (sum_a > sum_b) { cout << "Algosia\n"; return 0; } else if (sum_b > sum_a) { cout << "Bajtek\n"; return 0; } else { sort(a, a+n); sort(b, b+n); for (int i = 17; i >= 0; i--) { if (a[i] > b[i]) { cout << "Algosia\n"; return 0; } else if (a[i] < b[i]) { cout << "Bajtek\n"; return 0; } } } cout << "remis\n"; } |