#include<bits/stdc++.h> using namespace std; const int s = 18; int Bajtek[s]; int Algosia[s]; void f() { int suma_b = 0, suma_a = 0; for (int i = 0; i < s; i++){ cin >> Algosia[i]; suma_a += Algosia[i]; } for (int i = 0; i < s; i++){ cin >> Bajtek[i]; suma_b += Bajtek[i]; } if (suma_a > suma_b){ cout << "Algosia"; return; } else if (suma_b > suma_a){ cout << "Bajtek"; return; } for (int j = 10; j > 0; j --){ suma_a = 0; suma_b = 0; for (int i = 0; i < s; i ++){ if (Algosia[i] == j) suma_a ++; if (Bajtek[i] == j) suma_b ++; } if (suma_a > suma_b){ cout << "Algosia"; return; } else if (suma_b > suma_a){ cout << "Bajtek"; return; } } cout << "remis"; return; } int main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); f(); 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 45 46 47 48 | #include<bits/stdc++.h> using namespace std; const int s = 18; int Bajtek[s]; int Algosia[s]; void f() { int suma_b = 0, suma_a = 0; for (int i = 0; i < s; i++){ cin >> Algosia[i]; suma_a += Algosia[i]; } for (int i = 0; i < s; i++){ cin >> Bajtek[i]; suma_b += Bajtek[i]; } if (suma_a > suma_b){ cout << "Algosia"; return; } else if (suma_b > suma_a){ cout << "Bajtek"; return; } for (int j = 10; j > 0; j --){ suma_a = 0; suma_b = 0; for (int i = 0; i < s; i ++){ if (Algosia[i] == j) suma_a ++; if (Bajtek[i] == j) suma_b ++; } if (suma_a > suma_b){ cout << "Algosia"; return; } else if (suma_b > suma_a){ cout << "Bajtek"; return; } } cout << "remis"; return; } int main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); f(); return 0; } |