#include<iostream> #include<vector> #include<algorithm> using namespace std; int main(){ ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); int v1,sum; vector<int>v[2]; for(int j=0;j<2;j++){ sum=0; for(int i=0;i<18;i++){ cin>>v1; sum+=v1; v[j].push_back(v1); } v[j].push_back(sum); sort(v[j].begin(),v[j].end()); } for(int i=18;i>=0;i--){ if(v[0][i]>v[1][i]){ cout<<"Algosia\n"; return 0; } if(v[1][i]>v[0][i]){ 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 | #include<iostream> #include<vector> #include<algorithm> using namespace std; int main(){ ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); int v1,sum; vector<int>v[2]; for(int j=0;j<2;j++){ sum=0; for(int i=0;i<18;i++){ cin>>v1; sum+=v1; v[j].push_back(v1); } v[j].push_back(sum); sort(v[j].begin(),v[j].end()); } for(int i=18;i>=0;i--){ if(v[0][i]>v[1][i]){ cout<<"Algosia\n"; return 0; } if(v[1][i]>v[0][i]){ cout<<"Bajtek\n"; return 0; } } cout<<"remis\n"; return 0; } |