#include <iostream> #include <string> using namespace std; int A[11] = {}, B[11] = {}; int read(int T[]) { int suma = 0; for (int i = 0; i < 18; ++i) { int x; cin >> x; suma += x; ++T[x]; } return suma; } string check(const int A[], const int B[], int sumaA, int sumaB) { const string AL = "Algosia", BA = "Bajtek"; if (sumaA != sumaB) return sumaA > sumaB ? AL : BA; for (int n = 10; n > 0; --n) if (A[n] != B[n]) return A[n] > B[n] ? AL : BA; return "remis"; } int main() { ios::sync_with_stdio(0); cin.tie(0); int sumaA = read(A), sumaB = read(B); string winner = check(A, B, sumaA, sumaB); cout << winner << endl; 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 | #include <iostream> #include <string> using namespace std; int A[11] = {}, B[11] = {}; int read(int T[]) { int suma = 0; for (int i = 0; i < 18; ++i) { int x; cin >> x; suma += x; ++T[x]; } return suma; } string check(const int A[], const int B[], int sumaA, int sumaB) { const string AL = "Algosia", BA = "Bajtek"; if (sumaA != sumaB) return sumaA > sumaB ? AL : BA; for (int n = 10; n > 0; --n) if (A[n] != B[n]) return A[n] > B[n] ? AL : BA; return "remis"; } int main() { ios::sync_with_stdio(0); cin.tie(0); int sumaA = read(A), sumaB = read(B); string winner = check(A, B, sumaA, sumaB); cout << winner << endl; return 0; } |