#include <iostream> #include <vector> using namespace std; int main() { int n = 18; vector<int> a(11, 0); vector<int> b(11, 0); int temp; int suma_a = 0; int suma_b = 0; for (int i = 0; i<n; i++) { cin >> temp; a[temp]++; suma_a+=temp; } for (int i = 0; i<n; i++) { cin >> temp; b[temp]++; suma_b+=temp; } if (suma_a > suma_b) { cout << "Algosia" << endl; return 0; } else if (suma_a < suma_b) { cout << "Bajtek" << endl; return 0; } else { int checked = 10; while (checked > 0) { if (a[checked] > b[checked]) { cout << "Algosia" << endl; return 0; } else if (a[checked] < b[checked]) { cout << "Bajtek" << endl; return 0; } else { checked--; } } cout << "remis" << 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 | #include <iostream> #include <vector> using namespace std; int main() { int n = 18; vector<int> a(11, 0); vector<int> b(11, 0); int temp; int suma_a = 0; int suma_b = 0; for (int i = 0; i<n; i++) { cin >> temp; a[temp]++; suma_a+=temp; } for (int i = 0; i<n; i++) { cin >> temp; b[temp]++; suma_b+=temp; } if (suma_a > suma_b) { cout << "Algosia" << endl; return 0; } else if (suma_a < suma_b) { cout << "Bajtek" << endl; return 0; } else { int checked = 10; while (checked > 0) { if (a[checked] > b[checked]) { cout << "Algosia" << endl; return 0; } else if (a[checked] < b[checked]) { cout << "Bajtek" << endl; return 0; } else { checked--; } } cout << "remis" << endl; } return 0; } |