#include <iostream> #include <algorithm> using namespace std; const int ILE = 19; int algosia[ILE]; int bajtek[ILE]; int main() { for (int i = 1; i < ILE; i++) { cin >> algosia[i]; algosia[0] += algosia[i]; } sort(algosia, algosia + ILE, greater<int>()); for (int i = 1; i < ILE; i++) { cin >> bajtek[i]; bajtek[0] += bajtek[i]; } sort(bajtek, bajtek + ILE, greater<int>()); for (int i = 0; i < ILE; i++) { if (algosia[i] > bajtek[i]) { cout << "Algosia"; return 0; } if (bajtek[i] > algosia[i]) { 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 30 31 32 33 34 35 36 37 38 39 | #include <iostream> #include <algorithm> using namespace std; const int ILE = 19; int algosia[ILE]; int bajtek[ILE]; int main() { for (int i = 1; i < ILE; i++) { cin >> algosia[i]; algosia[0] += algosia[i]; } sort(algosia, algosia + ILE, greater<int>()); for (int i = 1; i < ILE; i++) { cin >> bajtek[i]; bajtek[0] += bajtek[i]; } sort(bajtek, bajtek + ILE, greater<int>()); for (int i = 0; i < ILE; i++) { if (algosia[i] > bajtek[i]) { cout << "Algosia"; return 0; } if (bajtek[i] > algosia[i]) { cout << "Bajtek"; return 0; } } cout << "remis"; return 0; } |