#include <iostream> int main() { int algosia[18]; int bajtek[18]; int algosiaPointsSum = 0; int bajtekPointsSum = 0; int algosiaTasksPoints[11] = { 0 }; int bajtekTasksPoints[11] = { 0 }; for (int i = 0; i < 18; i++) { std::cin >> algosia[i]; int points = algosia[i]; algosiaPointsSum += points; algosiaTasksPoints[points]++; } for (int i = 0; i < 18; i++) { std::cin >> bajtek[i]; int points = bajtek[i]; bajtekPointsSum += points; bajtekTasksPoints[points]++; } if (algosiaPointsSum > bajtekPointsSum) { std::cout << "Algosia"; } else if (algosiaPointsSum < bajtekPointsSum) { std::cout << "Bajtek"; } else { for (int i = 10; i >= 0; i--) { if (algosiaTasksPoints[i] > bajtekTasksPoints[i]) { std::cout << "Algosia"; return 0; } else if (algosiaTasksPoints[i] < bajtekTasksPoints[i]) { 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 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 | #include <iostream> int main() { int algosia[18]; int bajtek[18]; int algosiaPointsSum = 0; int bajtekPointsSum = 0; int algosiaTasksPoints[11] = { 0 }; int bajtekTasksPoints[11] = { 0 }; for (int i = 0; i < 18; i++) { std::cin >> algosia[i]; int points = algosia[i]; algosiaPointsSum += points; algosiaTasksPoints[points]++; } for (int i = 0; i < 18; i++) { std::cin >> bajtek[i]; int points = bajtek[i]; bajtekPointsSum += points; bajtekTasksPoints[points]++; } if (algosiaPointsSum > bajtekPointsSum) { std::cout << "Algosia"; } else if (algosiaPointsSum < bajtekPointsSum) { std::cout << "Bajtek"; } else { for (int i = 10; i >= 0; i--) { if (algosiaTasksPoints[i] > bajtekTasksPoints[i]) { std::cout << "Algosia"; return 0; } else if (algosiaTasksPoints[i] < bajtekTasksPoints[i]) { std::cout << "Bajtek"; return 0; } } std::cout << "remis"; } return 0; } |