#include <bits/stdc++.h> #define fi first #define se second using namespace std; typedef long long ll; int main(){ ios_base::sync_with_stdio(false); cin.tie(NULL); int n = 18; vector<int> a(n), b(n); int suma = 0, sumb = 0; for (int i=0; i<n; i++){ cin >> a[i]; suma += a[i]; } for (int i=0; i<n; i++){ cin >> b[i]; sumb += b[i]; } sort(a.begin(), a.end()); sort(b.begin(), b.end()); //cout << suma << ' ' << sumb << '\n'; if (suma > sumb) cout << "Algosia\n"; else if (sumb > suma) cout << "Bajtek\n"; else{ for (int i=n-1; i>=0; i--){ //cout << a[i] << ' ' << b[i] << '\n'; if (a[i] > b[i]){ cout << "Algosia\n"; return 0; }else if (b[i] > a[i]){ cout << "Bajtek\n"; return 0; } } cout << "remis\n"; } return 0; } /* 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 8 9 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 9 8 */
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 | #include <bits/stdc++.h> #define fi first #define se second using namespace std; typedef long long ll; int main(){ ios_base::sync_with_stdio(false); cin.tie(NULL); int n = 18; vector<int> a(n), b(n); int suma = 0, sumb = 0; for (int i=0; i<n; i++){ cin >> a[i]; suma += a[i]; } for (int i=0; i<n; i++){ cin >> b[i]; sumb += b[i]; } sort(a.begin(), a.end()); sort(b.begin(), b.end()); //cout << suma << ' ' << sumb << '\n'; if (suma > sumb) cout << "Algosia\n"; else if (sumb > suma) cout << "Bajtek\n"; else{ for (int i=n-1; i>=0; i--){ //cout << a[i] << ' ' << b[i] << '\n'; if (a[i] > b[i]){ cout << "Algosia\n"; return 0; }else if (b[i] > a[i]){ cout << "Bajtek\n"; return 0; } } cout << "remis\n"; } return 0; } /* 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 8 9 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 9 8 */ |