#include <bits/stdc++.h> using namespace std; constexpr int n = 18; int algosia[20], bajtek[20]; int main(){ ios_base::sync_with_stdio(0); cin.tie(0); int sum1 = 0, sum2 = 0; for(int i = 1; i <= 18; i++){ int a; cin >> a; algosia[a]++; sum1 += a; } for(int i = 1; i <= 18; i++){ int a; cin >> a; bajtek[a]++; sum2 += a; } if(sum1 > sum2) cout << "Algosia \n"; else if(sum1 < sum2) cout << "Bajtek \n"; else{ bool any = 0; for(int i = 10; i >= 0; i--){ if(algosia[i] > bajtek[i]){ any = 1; cout << "Algosia \n"; break; } else if(bajtek[i] > algosia[i]){ any = 1; cout << "Bajtek \n"; break; } } if(!any) cout << "remis \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 43 44 45 | #include <bits/stdc++.h> using namespace std; constexpr int n = 18; int algosia[20], bajtek[20]; int main(){ ios_base::sync_with_stdio(0); cin.tie(0); int sum1 = 0, sum2 = 0; for(int i = 1; i <= 18; i++){ int a; cin >> a; algosia[a]++; sum1 += a; } for(int i = 1; i <= 18; i++){ int a; cin >> a; bajtek[a]++; sum2 += a; } if(sum1 > sum2) cout << "Algosia \n"; else if(sum1 < sum2) cout << "Bajtek \n"; else{ bool any = 0; for(int i = 10; i >= 0; i--){ if(algosia[i] > bajtek[i]){ any = 1; cout << "Algosia \n"; break; } else if(bajtek[i] > algosia[i]){ any = 1; cout << "Bajtek \n"; break; } } if(!any) cout << "remis \n"; } } |