#include<bits/stdc++.h> using namespace std; void get_results(int a_sum, vector<int> a_vector, int b_sum, vector<int> b_vector){ int result = 0; if (a_sum > b_sum){ result = 1; } else if (b_sum > a_sum){ result = -1; } else{ int i = 10; while (i >= 0 && a_vector[i] == b_vector[i]) i--; if (i >= 0){ if (a_vector[i] > b_vector[i]){ result = 1; } else if (a_vector[i] < b_vector[i]){ result = -1; } } } switch (result){ case 1: cout << "Algosia"; break; case -1: cout << "Bajtek"; break; default: cout << "remis"; break; } } int main(){ vector<int> a_vector(11, 0), b_vector(11, 0); int a_sum = 0, b_sum = 0; for (int i = 0; i < 18; i++){ int x; cin >> x; a_sum += x; a_vector[x]++; } for (int i = 0; i < 18; i++){ int x; cin >> x; b_sum += x; b_vector[x]++; } get_results(a_sum, a_vector, b_sum, b_vector); 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 | #include<bits/stdc++.h> using namespace std; void get_results(int a_sum, vector<int> a_vector, int b_sum, vector<int> b_vector){ int result = 0; if (a_sum > b_sum){ result = 1; } else if (b_sum > a_sum){ result = -1; } else{ int i = 10; while (i >= 0 && a_vector[i] == b_vector[i]) i--; if (i >= 0){ if (a_vector[i] > b_vector[i]){ result = 1; } else if (a_vector[i] < b_vector[i]){ result = -1; } } } switch (result){ case 1: cout << "Algosia"; break; case -1: cout << "Bajtek"; break; default: cout << "remis"; break; } } int main(){ vector<int> a_vector(11, 0), b_vector(11, 0); int a_sum = 0, b_sum = 0; for (int i = 0; i < 18; i++){ int x; cin >> x; a_sum += x; a_vector[x]++; } for (int i = 0; i < 18; i++){ int x; cin >> x; b_sum += x; b_vector[x]++; } get_results(a_sum, a_vector, b_sum, b_vector); return 0; } |