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