#include <bits/stdc++.h> #define int long long using namespace std; int32_t main() { ios::sync_with_stdio(0); cin.tie(0); int n = 18; vector <int> a(n); vector <int> b(n); int sum1 = 0, sum2 = 0; for(int i = 0; i < n; i++){ cin >> a[i]; sum1 += a[i]; } for(int i = 0; i < n; i++){ cin >> b[i]; sum2 += b[i]; } sort(a.begin(), a.end()); sort(b.begin(), b.end()); if(sum1 > sum2){ cout << "Algosia"; return 0; } if(sum2 > sum1){ cout << "Bajtek"; return 0; } for(int i = n-1; i > -1; i--) { if(a[i] > b[i]) { cout << "Algosia"; return 0; } if(a[i] < b[i]) { cout << "Bajtek"; return 0; } } 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 | #include <bits/stdc++.h> #define int long long using namespace std; int32_t main() { ios::sync_with_stdio(0); cin.tie(0); int n = 18; vector <int> a(n); vector <int> b(n); int sum1 = 0, sum2 = 0; for(int i = 0; i < n; i++){ cin >> a[i]; sum1 += a[i]; } for(int i = 0; i < n; i++){ cin >> b[i]; sum2 += b[i]; } sort(a.begin(), a.end()); sort(b.begin(), b.end()); if(sum1 > sum2){ cout << "Algosia"; return 0; } if(sum2 > sum1){ cout << "Bajtek"; return 0; } for(int i = n-1; i > -1; i--) { if(a[i] > b[i]) { cout << "Algosia"; return 0; } if(a[i] < b[i]) { cout << "Bajtek"; return 0; } } cout << "remis"; return 0; } |