#include <iostream> #include <queue> using namespace std; int main() { ios_base::sync_with_stdio(0); int s1 = 0, s2 = 0; vector<int>cnt1(11), cnt2(11); int n = 18; for(int i = 0; i < n; i++) { int x; cin >> x; cnt1[x]++; s1 += x; } for(int i = 0; i < n; i++) { int x; cin >> x; cnt2[x]++; s2 += x; } if(s1 > s2) { cout << "Algosia\n"; return 0; } else if(s1 < s2) { cout << "Bajtek\n"; return 0; } else { for(int i = 10; i >= 0; i--) { if(cnt1[i] != cnt2[i]) { if(cnt1[i] > cnt2[i]) cout << "Algosia\n"; else cout << "Bajtek\n"; return 0; } } } cout << "remis\n"; 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 | #include <iostream> #include <queue> using namespace std; int main() { ios_base::sync_with_stdio(0); int s1 = 0, s2 = 0; vector<int>cnt1(11), cnt2(11); int n = 18; for(int i = 0; i < n; i++) { int x; cin >> x; cnt1[x]++; s1 += x; } for(int i = 0; i < n; i++) { int x; cin >> x; cnt2[x]++; s2 += x; } if(s1 > s2) { cout << "Algosia\n"; return 0; } else if(s1 < s2) { cout << "Bajtek\n"; return 0; } else { for(int i = 10; i >= 0; i--) { if(cnt1[i] != cnt2[i]) { if(cnt1[i] > cnt2[i]) cout << "Algosia\n"; else cout << "Bajtek\n"; return 0; } } } cout << "remis\n"; return 0; } |