#include <iostream> #include <algorithm> using namespace std; int t1[20], t2[20], t3[11], t4[11], sum1=0, sum2=0; int main(){ for(int i=0;i<18;i++){ cin>>t1[i]; sum1 += t1[i]; t3[t1[i]]++; } for(int i=0;i<18;i++){ cin>>t2[i]; sum2 += t2[i]; t4[t2[i]]++; } if(sum1>sum2){ cout<<"Algosia"; } else if(sum1<sum2){ cout<<"Bajtek"; } else{ for(int i=10;i>=0;i--){ if(t3[i]>t4[i]){ cout<<"Algosia"; return 0; } else if(t3[i]<t4[i]){ 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 | #include <iostream> #include <algorithm> using namespace std; int t1[20], t2[20], t3[11], t4[11], sum1=0, sum2=0; int main(){ for(int i=0;i<18;i++){ cin>>t1[i]; sum1 += t1[i]; t3[t1[i]]++; } for(int i=0;i<18;i++){ cin>>t2[i]; sum2 += t2[i]; t4[t2[i]]++; } if(sum1>sum2){ cout<<"Algosia"; } else if(sum1<sum2){ cout<<"Bajtek"; } else{ for(int i=10;i>=0;i--){ if(t3[i]>t4[i]){ cout<<"Algosia"; return 0; } else if(t3[i]<t4[i]){ cout<<"Bajtek"; return 0; } } cout<<"remis"; } return 0; } |