#include<iostream>
#include<algorithm>
using namespace std;
int t1[18], t2[18];
int porownaj(){
for(int i = 17; i >= 0; i--){
if(t1[i] > t2[i]) { return 1; }
if(t1[i] < t2[i]) { return 0; }
}
return 2;
}
int s1 = 0, s2 = 0;
int main(){
ios::sync_with_stdio(0);
for(int i = 17; i >= 0; i--){
cin >> t1[i]; s1 += t1[i];
}
for(int i = 0; i < 18; i++){
cin >> t2[i]; s2 += t2[i];
}
if(s1 > s2) cout << "Algosia";
else if(s2 > s1) cout << "Bajtek";
else{
sort(t1, t1 + 18);
sort(t2, t2 + 18);
if(porownaj() == 1) cout << "Algosia";
else if(porownaj() == 0) cout << "Bajtek";
else 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 | #include<iostream> #include<algorithm> using namespace std; int t1[18], t2[18]; int porownaj(){ for(int i = 17; i >= 0; i--){ if(t1[i] > t2[i]) { return 1; } if(t1[i] < t2[i]) { return 0; } } return 2; } int s1 = 0, s2 = 0; int main(){ ios::sync_with_stdio(0); for(int i = 17; i >= 0; i--){ cin >> t1[i]; s1 += t1[i]; } for(int i = 0; i < 18; i++){ cin >> t2[i]; s2 += t2[i]; } if(s1 > s2) cout << "Algosia"; else if(s2 > s1) cout << "Bajtek"; else{ sort(t1, t1 + 18); sort(t2, t2 + 18); if(porownaj() == 1) cout << "Algosia"; else if(porownaj() == 0) cout << "Bajtek"; else cout << "remis"; } } |
English