#include <bits/stdc++.h> using namespace std; #define ll long long /*input 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 8 10 10 10 10 10 10 10 10 10 10 10 7 10 10 10 10 10 10 */ int sum1 = 0, sum2 = 0; vector<int> a(20), b(20); const int n = 18; string solve() { if (sum1 > sum2) return "Algosia"; else if (sum1 < sum2) return "Bajtek"; for (int i=10; i>=1; i--) { // cout << i << '\n'; if (a[i] > b[i]) return "Algosia"; if (a[i] < b[i]) return "Bajtek"; } return "remis"; } int main() { int num; for (int i=0; i<n; i++) { cin >> num; sum1 += num; a[num]++; } for (int i=0; i<n; i++) { cin >> num; sum2 += num; b[num]++; } cout << solve() << '\n'; }
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 | #include <bits/stdc++.h> using namespace std; #define ll long long /*input 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 8 10 10 10 10 10 10 10 10 10 10 10 7 10 10 10 10 10 10 */ int sum1 = 0, sum2 = 0; vector<int> a(20), b(20); const int n = 18; string solve() { if (sum1 > sum2) return "Algosia"; else if (sum1 < sum2) return "Bajtek"; for (int i=10; i>=1; i--) { // cout << i << '\n'; if (a[i] > b[i]) return "Algosia"; if (a[i] < b[i]) return "Bajtek"; } return "remis"; } int main() { int num; for (int i=0; i<n; i++) { cin >> num; sum1 += num; a[num]++; } for (int i=0; i<n; i++) { cin >> num; sum2 += num; b[num]++; } cout << solve() << '\n'; } |