#include<iostream> #include<vector> using namespace std; int main() { vector<int>A(18); vector<int>B(18); vector<int>odpA(11,0); vector<int>odpB(11,0); int sumaA=0; int sumaB=0; for(int i =0;i<18;i++) { cin>>A[i]; odpA[A[i]]++; sumaA+=A[i]; } for(int i =0;i<18;i++) { cin>>B[i]; odpB[B[i]]++; sumaB+=B[i]; } bool Awin=0; bool Bwin=0; int z=10; if(sumaA>sumaB) Awin=1; if(sumaA<sumaB) Bwin=1; while (Awin==0&&Bwin==0&&z>0) { if(odpA[z]>odpB[z]) Awin=1; if(odpA[z]<odpB[z]) Bwin=1; z--; } if(Awin==1) cout<<"Algosia"; if(Bwin==1) cout<<"Bajtek"; if(Awin==0&&Bwin==0) cout<<"remis"; }
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 | #include<iostream> #include<vector> using namespace std; int main() { vector<int>A(18); vector<int>B(18); vector<int>odpA(11,0); vector<int>odpB(11,0); int sumaA=0; int sumaB=0; for(int i =0;i<18;i++) { cin>>A[i]; odpA[A[i]]++; sumaA+=A[i]; } for(int i =0;i<18;i++) { cin>>B[i]; odpB[B[i]]++; sumaB+=B[i]; } bool Awin=0; bool Bwin=0; int z=10; if(sumaA>sumaB) Awin=1; if(sumaA<sumaB) Bwin=1; while (Awin==0&&Bwin==0&&z>0) { if(odpA[z]>odpB[z]) Awin=1; if(odpA[z]<odpB[z]) Bwin=1; z--; } if(Awin==1) cout<<"Algosia"; if(Bwin==1) cout<<"Bajtek"; if(Awin==0&&Bwin==0) cout<<"remis"; } |