#include <iostream> using namespace std; int main(int argc, char *argv[]) { std::ios_base::sync_with_stdio(false); std::cin.tie(NULL); int algosia[18]; int ranking_a[11]; int bajtek[18]; int ranking_b[11]; for (int i=0; i<11; i++) { ranking_a[i] = 0; ranking_b[i] = 0; } int suma_a = 0; int suma_b = 0; for (int i=0; i<18; i++) { cin>>algosia[i]; suma_a += algosia[i]; ranking_a[algosia[i]]++; } for (int i=0; i<18; i++) { cin>>bajtek[i]; suma_b += bajtek[i]; ranking_b[bajtek[i]]++; } if (suma_a != suma_b) { if (suma_a > suma_b) { cout << "Algosia"; } else { cout << "Bajtek"; } return 0; } for (int i=10; i>0; i--) { if (ranking_a[i] != ranking_b[i]) { if (ranking_a[i] > ranking_b[i]) { cout << "Algosia"; } else { cout << "Bajtek"; } return 0; } } 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> using namespace std; int main(int argc, char *argv[]) { std::ios_base::sync_with_stdio(false); std::cin.tie(NULL); int algosia[18]; int ranking_a[11]; int bajtek[18]; int ranking_b[11]; for (int i=0; i<11; i++) { ranking_a[i] = 0; ranking_b[i] = 0; } int suma_a = 0; int suma_b = 0; for (int i=0; i<18; i++) { cin>>algosia[i]; suma_a += algosia[i]; ranking_a[algosia[i]]++; } for (int i=0; i<18; i++) { cin>>bajtek[i]; suma_b += bajtek[i]; ranking_b[bajtek[i]]++; } if (suma_a != suma_b) { if (suma_a > suma_b) { cout << "Algosia"; } else { cout << "Bajtek"; } return 0; } for (int i=10; i>0; i--) { if (ranking_a[i] != ranking_b[i]) { if (ranking_a[i] > ranking_b[i]) { cout << "Algosia"; } else { cout << "Bajtek"; } return 0; } } cout<<"remis"; return 0; } |