#include <bits/stdc++.h> using namespace std; int main(){ int T[11],C[11]; for (int i = 1; i <= 10;i++){ T[i] = 0; C[i] = 0; } int suma1 = 0; for (int i = 1; i <= 18;i++){ int a; cin >> a; T[a]++; suma1 += a; } for (int i = 1; i <= 18;i++){ int a; cin >> a; C[a]++; suma1 -= a; } int w = 0; if(suma1 > 0)w = -1; if(suma1 < 0)w = 1; for (int i = 10; i >= 1;i--){ if(w == 0){ if(T[i] > C[i])w = -1; if(T[i] < C[i])w = 1; } } if(w == -1){ cout << "Algosia" << '\n'; } else if(w == 1){ cout << "Bajtek" << '\n'; } else{ cout << "remis" << '\n'; } }
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 | #include <bits/stdc++.h> using namespace std; int main(){ int T[11],C[11]; for (int i = 1; i <= 10;i++){ T[i] = 0; C[i] = 0; } int suma1 = 0; for (int i = 1; i <= 18;i++){ int a; cin >> a; T[a]++; suma1 += a; } for (int i = 1; i <= 18;i++){ int a; cin >> a; C[a]++; suma1 -= a; } int w = 0; if(suma1 > 0)w = -1; if(suma1 < 0)w = 1; for (int i = 10; i >= 1;i--){ if(w == 0){ if(T[i] > C[i])w = -1; if(T[i] < C[i])w = 1; } } if(w == -1){ cout << "Algosia" << '\n'; } else if(w == 1){ cout << "Bajtek" << '\n'; } else{ cout << "remis" << '\n'; } } |