// Jan Zakrzewski #include <bits/stdc++.h> using namespace std; int a_suma, a_ile[11]; int b_suma, b_ile[11]; const char ALGOSIA[] = "Algosia"; const char BAJTEK[] = "Bajtek"; const char REMIS[] = "remis"; const char* kto; int main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); a_suma = 0; b_suma = 0; for(int x = 1; x <= 10; ++x) { a_ile[x] = 0; b_ile[x] = 0; } for(int i = 1; i <= 18; ++i) { int x; cin >> x; if(x > 0) { ++a_ile[x]; a_suma += x; } } for(int i = 1; i <= 18; ++i) { int x; cin >> x; if(x > 0) { ++b_ile[x]; b_suma += x; } } if(a_suma > b_suma) kto = ALGOSIA; else if(a_suma < b_suma) kto = BAJTEK; else { kto = REMIS; for(int x = 10; x >= 1; --x) { if(a_ile[x] > b_ile[x]) { kto = ALGOSIA; break; } else if(a_ile[x] < b_ile[x]) { kto = BAJTEK; break; } } } cout << kto << "\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 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 | // Jan Zakrzewski #include <bits/stdc++.h> using namespace std; int a_suma, a_ile[11]; int b_suma, b_ile[11]; const char ALGOSIA[] = "Algosia"; const char BAJTEK[] = "Bajtek"; const char REMIS[] = "remis"; const char* kto; int main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); a_suma = 0; b_suma = 0; for(int x = 1; x <= 10; ++x) { a_ile[x] = 0; b_ile[x] = 0; } for(int i = 1; i <= 18; ++i) { int x; cin >> x; if(x > 0) { ++a_ile[x]; a_suma += x; } } for(int i = 1; i <= 18; ++i) { int x; cin >> x; if(x > 0) { ++b_ile[x]; b_suma += x; } } if(a_suma > b_suma) kto = ALGOSIA; else if(a_suma < b_suma) kto = BAJTEK; else { kto = REMIS; for(int x = 10; x >= 1; --x) { if(a_ile[x] > b_ile[x]) { kto = ALGOSIA; break; } else if(a_ile[x] < b_ile[x]) { kto = BAJTEK; break; } } } cout << kto << "\n"; return 0; } |