#include <bits/stdc++.h> using namespace std; void koniec(int a){ if(a == 0) cout << "Algosia\n"; if(a == 2) cout << "Bajtek\n"; if(a == 1) cout << "remis\n"; exit(0); } int main() { int n=18; vector<int> a(n), b(n); int sa=0, sb=0; for(int i=0; i<n; ++i) cin >> a[i], sa += a[i]; for(int i=0; i<n; ++i) cin >> b[i], sb += b[i]; sort(a.begin(), a.end(), greater<int>()); sort(b.begin(), b.end(), greater<int>()); if(sa > sb) koniec(0); if(sa < sb) koniec(2); for(int i=0; i<n; ++i){ if(a[i] > b[i]) koniec(0); if(a[i] < b[i]) koniec(2); } koniec(1); 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 30 31 32 33 34 35 36 | #include <bits/stdc++.h> using namespace std; void koniec(int a){ if(a == 0) cout << "Algosia\n"; if(a == 2) cout << "Bajtek\n"; if(a == 1) cout << "remis\n"; exit(0); } int main() { int n=18; vector<int> a(n), b(n); int sa=0, sb=0; for(int i=0; i<n; ++i) cin >> a[i], sa += a[i]; for(int i=0; i<n; ++i) cin >> b[i], sb += b[i]; sort(a.begin(), a.end(), greater<int>()); sort(b.begin(), b.end(), greater<int>()); if(sa > sb) koniec(0); if(sa < sb) koniec(2); for(int i=0; i<n; ++i){ if(a[i] > b[i]) koniec(0); if(a[i] < b[i]) koniec(2); } koniec(1); return 0; } |