#include <iostream> #include <vector> int main() { int tab_a[18], tab_b[18]; int sb = 0; int sa = 0; int tabz1[10], tabz2[10]; bool boolean = true; for (int i = 0; i < 18; i++) { int input; std::cin >> input; tab_a[i] = input; sa = sa + tab_a[i]; tabz1[tab_a[i]] += 1; } for (int i = 0; i < 18; i++) { int input; std::cin >> input; tab_b[i] = input; sb = sb + tab_a[i]; tabz2[tab_b[i]] += 1; } if (sb > sa) { std::cout << "Bajtek" << std::endl; } else if (sb < sa) { std::cout << "Algosia" << std::endl; } else { for (int i = 10; i > 0; i--) { if (tabz1[i] > tabz2[i] && boolean == true) { std::cout << "Algosia" << std::endl; boolean = false; break; } else if (tabz2[i] > tabz1[i] && boolean == true) { std::cout << "Bajtek" << std::endl; boolean = false; break; } } if(boolean == true) std::cout << "remis" << std::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 39 40 41 42 43 44 45 46 47 48 49 | #include <iostream> #include <vector> int main() { int tab_a[18], tab_b[18]; int sb = 0; int sa = 0; int tabz1[10], tabz2[10]; bool boolean = true; for (int i = 0; i < 18; i++) { int input; std::cin >> input; tab_a[i] = input; sa = sa + tab_a[i]; tabz1[tab_a[i]] += 1; } for (int i = 0; i < 18; i++) { int input; std::cin >> input; tab_b[i] = input; sb = sb + tab_a[i]; tabz2[tab_b[i]] += 1; } if (sb > sa) { std::cout << "Bajtek" << std::endl; } else if (sb < sa) { std::cout << "Algosia" << std::endl; } else { for (int i = 10; i > 0; i--) { if (tabz1[i] > tabz2[i] && boolean == true) { std::cout << "Algosia" << std::endl; boolean = false; break; } else if (tabz2[i] > tabz1[i] && boolean == true) { std::cout << "Bajtek" << std::endl; boolean = false; break; } } if(boolean == true) std::cout << "remis" << std::endl; } return 0; } |