#include<bits/stdc++.h> using namespace std; #ifdef DEBUG auto&operator <<(auto& o, pair<auto, auto> p) {return o<<"("<<p.first<<", "<<p.second<<")";} auto operator <<(auto& o, auto x)->decltype(x.end(), o) {o<<"{"; for(auto v : x) o<<v<<", "; return o<<"}";} #define debug(X) cout<<"["#X"]"<<X<<endl; #else #define debug(X) {} #endif #define int long long int32_t main() { ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); string alg; alg.resize(18, (char)0); string baj; baj.resize(18, (char)0); int a = 0, b = 0; for(auto& v : alg) {int c; cin>>c; a += c; v = c;} for(auto& v : baj) {int c; cin>>c; b += c; v = c;} if(a > b) {cout<<"Algosia"; return 0;} if(a < b) {cout<<"Bajtek"; return 0;} sort(alg.begin(), alg.end()); sort(baj.begin(), baj.end()); reverse(alg.begin(), alg.end()); reverse(baj.begin(), baj.end()); if(alg > baj) {cout<<"Algosia"; return 0;} if(alg < baj) {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 | #include<bits/stdc++.h> using namespace std; #ifdef DEBUG auto&operator <<(auto& o, pair<auto, auto> p) {return o<<"("<<p.first<<", "<<p.second<<")";} auto operator <<(auto& o, auto x)->decltype(x.end(), o) {o<<"{"; for(auto v : x) o<<v<<", "; return o<<"}";} #define debug(X) cout<<"["#X"]"<<X<<endl; #else #define debug(X) {} #endif #define int long long int32_t main() { ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); string alg; alg.resize(18, (char)0); string baj; baj.resize(18, (char)0); int a = 0, b = 0; for(auto& v : alg) {int c; cin>>c; a += c; v = c;} for(auto& v : baj) {int c; cin>>c; b += c; v = c;} if(a > b) {cout<<"Algosia"; return 0;} if(a < b) {cout<<"Bajtek"; return 0;} sort(alg.begin(), alg.end()); sort(baj.begin(), baj.end()); reverse(alg.begin(), alg.end()); reverse(baj.begin(), baj.end()); if(alg > baj) {cout<<"Algosia"; return 0;} if(alg < baj) {cout<<"Bajtek"; return 0;} cout<<"remis"; return 0; } |