#include <bits/stdc++.h> using namespace std; const int n = 18; int main() { vector<int> A, B; int a_sum = 0, b_sum = 0; for (int i = 0; i < n; i++) { int a; cin >> a; A.push_back(a * -1); a_sum += a; } for (int i = 0; i < n; i++) { int a; cin >> a; B.push_back(a * -1); b_sum += a; } if (a_sum > b_sum) { cout << "Algosia\n"; return 0; } if (a_sum < b_sum) { cout << "Bajtek\n"; return 0; } sort(A.begin(), A.end()); sort(B.begin(), B.end()); bool ans = false; for (int i = 0; i < n; i++) { if (A[i] < B[i]) { cout << "Algosia\n"; ans = true; break; } if (A[i] > B[i]) { cout << "Bajtek\n"; ans = true; break; } } if (!ans) { 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 45 46 47 48 49 50 51 52 53 54 | #include <bits/stdc++.h> using namespace std; const int n = 18; int main() { vector<int> A, B; int a_sum = 0, b_sum = 0; for (int i = 0; i < n; i++) { int a; cin >> a; A.push_back(a * -1); a_sum += a; } for (int i = 0; i < n; i++) { int a; cin >> a; B.push_back(a * -1); b_sum += a; } if (a_sum > b_sum) { cout << "Algosia\n"; return 0; } if (a_sum < b_sum) { cout << "Bajtek\n"; return 0; } sort(A.begin(), A.end()); sort(B.begin(), B.end()); bool ans = false; for (int i = 0; i < n; i++) { if (A[i] < B[i]) { cout << "Algosia\n"; ans = true; break; } if (A[i] > B[i]) { cout << "Bajtek\n"; ans = true; break; } } if (!ans) { cout << "remis\n"; } } |