#include <bits/stdc++.h> using namespace std; #define FOR(i, lower, upper) for(int (i) = (lower); i <= (int)(upper); (i)++) #define FORD(i, upper, lower) for(int (i) = (upper); i >= (int)(lower); (i)--) #define PB push_back using ll = long long; int sa, cntA[11]; int sb, cntB[11]; string A = "Algosia", B = "Bajtek", R = "remis"; int main() { FOR(i, 1, 18) { int x; cin >> x; sa += x; cntA[x]++; } FOR(i, 1, 18) { int x; cin >> x; sb += x; cntB[x]++; } if(sa > sb) { cout << A; } else if(sa < sb) { cout << B; } else { FORD(i, 10, 1) { if(cntA[i] > cntB[i]) { cout << A; return 0; } else if(cntA[i] < cntB[i]) { cout << B; return 0; } } cout << R; } 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 | #include <bits/stdc++.h> using namespace std; #define FOR(i, lower, upper) for(int (i) = (lower); i <= (int)(upper); (i)++) #define FORD(i, upper, lower) for(int (i) = (upper); i >= (int)(lower); (i)--) #define PB push_back using ll = long long; int sa, cntA[11]; int sb, cntB[11]; string A = "Algosia", B = "Bajtek", R = "remis"; int main() { FOR(i, 1, 18) { int x; cin >> x; sa += x; cntA[x]++; } FOR(i, 1, 18) { int x; cin >> x; sb += x; cntB[x]++; } if(sa > sb) { cout << A; } else if(sa < sb) { cout << B; } else { FORD(i, 10, 1) { if(cntA[i] > cntB[i]) { cout << A; return 0; } else if(cntA[i] < cntB[i]) { cout << B; return 0; } } cout << R; } return 0; } |