#include <iostream> int main() { int a[18]; int b[18]; for (int & i : a) { std::cin >> i; } for (int & i : b) { std::cin >> i; } int totala = 0, totalb = 0; for (int i = 0; i < 18; i++) { totala += a[i]; totalb += b[i]; } if (totala > totalb) { std::cout << "Algosia"; return 0; } else if (totalb > totala) { std::cout << "Bajtek"; return 0; } else { for (int i = 10; i > 0; i--) { int counta = 0, countb = 0; for (int j = 0; j < 18; j++) { if (a[j] == i) counta++; if (b[j] == i) countb++; } if (counta > countb) { std::cout << "Algosia"; return 0; } else if (countb > counta) { std::cout << "Bajtek"; return 0; } } } std::cout << "remis"; 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 | #include <iostream> int main() { int a[18]; int b[18]; for (int & i : a) { std::cin >> i; } for (int & i : b) { std::cin >> i; } int totala = 0, totalb = 0; for (int i = 0; i < 18; i++) { totala += a[i]; totalb += b[i]; } if (totala > totalb) { std::cout << "Algosia"; return 0; } else if (totalb > totala) { std::cout << "Bajtek"; return 0; } else { for (int i = 10; i > 0; i--) { int counta = 0, countb = 0; for (int j = 0; j < 18; j++) { if (a[j] == i) counta++; if (b[j] == i) countb++; } if (counta > countb) { std::cout << "Algosia"; return 0; } else if (countb > counta) { std::cout << "Bajtek"; return 0; } } } std::cout << "remis"; return 0; } |