#include <bits/stdc++.h> using namespace std; int main() { vector<vector<int>> both; for (int who : {0, 1}) { int sum = 0; vector<int> freq(11); for (int rep = 0; rep < 18; rep++) { int x; cin >> x; freq[x]++; sum += x; } vector<int> v{sum}; for (int x = 10; x >= 0; x--) { v.push_back(freq[x]); } both.push_back(v); } if (both[0] > both[1]) { puts("Algosia"); } else if (both[1] > both[0]) { puts("Bajtek"); } else { puts("remis"); } }
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 | #include <bits/stdc++.h> using namespace std; int main() { vector<vector<int>> both; for (int who : {0, 1}) { int sum = 0; vector<int> freq(11); for (int rep = 0; rep < 18; rep++) { int x; cin >> x; freq[x]++; sum += x; } vector<int> v{sum}; for (int x = 10; x >= 0; x--) { v.push_back(freq[x]); } both.push_back(v); } if (both[0] > both[1]) { puts("Algosia"); } else if (both[1] > both[0]) { puts("Bajtek"); } else { puts("remis"); } } |