#include<iostream>
#include<algorithm>
#include<vector>
using namespace std;
int main() {
ios::sync_with_stdio(0);
int A,B;
vector<int> a,b;
int sa = 0, sb = 0;
for(int i=0; i<18; ++i) {
cin>>A;
sa += A;
a.push_back(A);
}
for(int i=0; i<18; ++i) {
cin>>B;
sb += B;
b.push_back(B);
}
if(sa > sb) {
cout<<"Algosia";
return 0;
}
else if(sa < sb) {
cout<<"Bajtek";
return 0;
}
sort(a.begin(),a.end());
sort(b.begin(),b.end());
for(int i=18; i>=1; --i) {
if(a[i-1] > b[i-1]) {
cout<<"Algosia";
return 0;
}
if(a[i-1] < b[i-1]) {
cout<<"Bajtek";
return 0;
}
}
cout<<"remis";
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 | #include<iostream> #include<algorithm> #include<vector> using namespace std; int main() { ios::sync_with_stdio(0); int A,B; vector<int> a,b; int sa = 0, sb = 0; for(int i=0; i<18; ++i) { cin>>A; sa += A; a.push_back(A); } for(int i=0; i<18; ++i) { cin>>B; sb += B; b.push_back(B); } if(sa > sb) { cout<<"Algosia"; return 0; } else if(sa < sb) { cout<<"Bajtek"; return 0; } sort(a.begin(),a.end()); sort(b.begin(),b.end()); for(int i=18; i>=1; --i) { if(a[i-1] > b[i-1]) { cout<<"Algosia"; return 0; } if(a[i-1] < b[i-1]) { cout<<"Bajtek"; return 0; } } cout<<"remis"; return 0; } |
English