#include <iostream> using namespace std; int tabz_1[11]; int tabz_2[10]; int tab_1[18]; int tab_2[18]; int suma_1; int suma_2; int main() { for (int i = 0; i < 18; i++){ cin >> tab_1[i]; suma_1 += tab_1[i]; for (int j = 0; j < 11; j++){ if (tab_1[i] == j){ tabz_1[j]++; } } } for (int i = 0; i < 18; i++){ cin >> tab_2[i]; suma_2 += tab_2[i]; for (int j = 0; j < 11; j++){ if (tab_2[i] == j){ tabz_2[j]++; } } } for (int i = 0; i < 10; i++){ if(suma_1 > suma_2){ cout << "Algosia"; return 0; } if (suma_1 < suma_2){ cout << "Bajtek"; return 0; } if (suma_1 == suma_2){ if (tabz_1[10-i] > tabz_2[10-i]){ cout << "Algosia"; return 0; } if (tabz_1[10-i] < tabz_2[10-i]){ cout << "Bajtek"; return 0; } } } for (int i = 0; i < 11; i++){ cout << i << " " << tabz_1[i] << 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 50 51 52 53 54 55 56 57 58 59 | #include <iostream> using namespace std; int tabz_1[11]; int tabz_2[10]; int tab_1[18]; int tab_2[18]; int suma_1; int suma_2; int main() { for (int i = 0; i < 18; i++){ cin >> tab_1[i]; suma_1 += tab_1[i]; for (int j = 0; j < 11; j++){ if (tab_1[i] == j){ tabz_1[j]++; } } } for (int i = 0; i < 18; i++){ cin >> tab_2[i]; suma_2 += tab_2[i]; for (int j = 0; j < 11; j++){ if (tab_2[i] == j){ tabz_2[j]++; } } } for (int i = 0; i < 10; i++){ if(suma_1 > suma_2){ cout << "Algosia"; return 0; } if (suma_1 < suma_2){ cout << "Bajtek"; return 0; } if (suma_1 == suma_2){ if (tabz_1[10-i] > tabz_2[10-i]){ cout << "Algosia"; return 0; } if (tabz_1[10-i] < tabz_2[10-i]){ cout << "Bajtek"; return 0; } } } for (int i = 0; i < 11; i++){ cout << i << " " << tabz_1[i] << endl; } return 0; } |