#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
bool por (int a, int b){
if (a > b){
return true;
}else{
return false;
}
}
int main(){
vector <int> algosia (18);
vector <int> bajtek (18);
int wynik1 = 0, wynik2 = 0;
for (int i = 0; i < 18; i++){
cin >> algosia[i];
wynik1 += algosia[i];
}
for (int i = 0; i < 18; i++){
cin >> bajtek[i];
wynik2 += bajtek[i];
}
sort(algosia.begin(), algosia.end(), por);
sort(bajtek.begin(), bajtek.end(), por);
if (wynik1 > wynik2){
cout << "Algosia\n";
}else if (wynik2 > wynik1){
cout << "Bajtek\n";
}else{
if (algosia > bajtek){
cout << "Algosia\n";
}else if (bajtek > algosia){
cout << "Bajtek\n";
}else{
cout << "remis\n";
}
}
}
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 <vector> #include <algorithm> using namespace std; bool por (int a, int b){ if (a > b){ return true; }else{ return false; } } int main(){ vector <int> algosia (18); vector <int> bajtek (18); int wynik1 = 0, wynik2 = 0; for (int i = 0; i < 18; i++){ cin >> algosia[i]; wynik1 += algosia[i]; } for (int i = 0; i < 18; i++){ cin >> bajtek[i]; wynik2 += bajtek[i]; } sort(algosia.begin(), algosia.end(), por); sort(bajtek.begin(), bajtek.end(), por); if (wynik1 > wynik2){ cout << "Algosia\n"; }else if (wynik2 > wynik1){ cout << "Bajtek\n"; }else{ if (algosia > bajtek){ cout << "Algosia\n"; }else if (bajtek > algosia){ cout << "Bajtek\n"; }else{ cout << "remis\n"; } } } |
English