#include<bits/stdc++.h>
using namespace std;
int main(){
vector<int> mapkaA(18,0);
vector<int> mapkaB(18,0);
//map<short,short> mapkaA;
//map<short,short> mapkaB;
short sumaA=0, sumaB=0, tmp;
for(short i=0;i<18;i++){
cin >> tmp;
mapkaA[tmp]++;
sumaA +=tmp;
}
for(short i=0;i<18;i++){
cin >> tmp;
mapkaB[tmp]++;
sumaB +=tmp;
}
if(sumaB > sumaA){
cout << "Bajtek" << endl;
}
else if(sumaA > sumaB){
cout << "Algosia" << endl;
}
else{
short i=10;
bool czyZnaleziono = false;
while(i>=0 && !czyZnaleziono){
short tmp2 = mapkaA[i];
short tmp3 = mapkaB[i];
if(tmp2 > tmp3){
cout << "Algosia" << endl;
czyZnaleziono = true;
}
else if(tmp3 > tmp2){
cout << "Bajtek" << endl;
czyZnaleziono = true;
}
i--;
}
if(i<0 && !czyZnaleziono){
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 | #include<bits/stdc++.h> using namespace std; int main(){ vector<int> mapkaA(18,0); vector<int> mapkaB(18,0); //map<short,short> mapkaA; //map<short,short> mapkaB; short sumaA=0, sumaB=0, tmp; for(short i=0;i<18;i++){ cin >> tmp; mapkaA[tmp]++; sumaA +=tmp; } for(short i=0;i<18;i++){ cin >> tmp; mapkaB[tmp]++; sumaB +=tmp; } if(sumaB > sumaA){ cout << "Bajtek" << endl; } else if(sumaA > sumaB){ cout << "Algosia" << endl; } else{ short i=10; bool czyZnaleziono = false; while(i>=0 && !czyZnaleziono){ short tmp2 = mapkaA[i]; short tmp3 = mapkaB[i]; if(tmp2 > tmp3){ cout << "Algosia" << endl; czyZnaleziono = true; } else if(tmp3 > tmp2){ cout << "Bajtek" << endl; czyZnaleziono = true; } i--; } if(i<0 && !czyZnaleziono){ cout << "remis" << endl; } } } |
English