#include <bits/stdc++.h>
#define endl '\n'
using namespace std;
int bajtosia = 0;
int bajtek = 0;
int bajtosia_wyniki[11];
int bajtek_wyniki[11];
int readInt () {
bool minus = false;
int result = 0;
char ch;
ch = getchar();
while (true) {
if (ch == '-') break;
if (ch >= '0' && ch <= '9') break;
ch = getchar();
}
if (ch == '-') minus = true; else result = ch-'0';
while (true) {
ch = getchar();
if (ch < '0' || ch > '9') break;
result = result*10 + (ch - '0');
}
if (minus)
return -result;
else
return result;
}
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
for (int i = 0; i < 18; i++) {
int a = readInt();
bajtosia += a;
bajtosia_wyniki[a]++;
}
for (int i = 0; i < 18; i++) {
int a = readInt();
bajtek += a;
bajtek_wyniki[a]++;
}
if (bajtosia > bajtek) {
cout << "Algosia" << endl;
return 0;
}
if (bajtek > bajtosia) {
cout << "Bajtek" << endl;
return 0;
}
for (int i = 10; i >= 0; i--) {
if (bajtosia_wyniki[i] > bajtek_wyniki[i]) {
cout << "Algosia" << endl;
return 0;
}
if (bajtek_wyniki[i] > bajtosia_wyniki[i]) {
cout << "Bajtek" << endl;
return 0;
}
}
cout << "remis" << endl;
}
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 61 62 63 64 65 66 | #include <bits/stdc++.h> #define endl '\n' using namespace std; int bajtosia = 0; int bajtek = 0; int bajtosia_wyniki[11]; int bajtek_wyniki[11]; int readInt () { bool minus = false; int result = 0; char ch; ch = getchar(); while (true) { if (ch == '-') break; if (ch >= '0' && ch <= '9') break; ch = getchar(); } if (ch == '-') minus = true; else result = ch-'0'; while (true) { ch = getchar(); if (ch < '0' || ch > '9') break; result = result*10 + (ch - '0'); } if (minus) return -result; else return result; } int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); for (int i = 0; i < 18; i++) { int a = readInt(); bajtosia += a; bajtosia_wyniki[a]++; } for (int i = 0; i < 18; i++) { int a = readInt(); bajtek += a; bajtek_wyniki[a]++; } if (bajtosia > bajtek) { cout << "Algosia" << endl; return 0; } if (bajtek > bajtosia) { cout << "Bajtek" << endl; return 0; } for (int i = 10; i >= 0; i--) { if (bajtosia_wyniki[i] > bajtek_wyniki[i]) { cout << "Algosia" << endl; return 0; } if (bajtek_wyniki[i] > bajtosia_wyniki[i]) { cout << "Bajtek" << endl; return 0; } } cout << "remis" << endl; } |
English