#include<iostream> using namespace std; int A[21], B[21]; int main() { const int N = 18, Range = 10; int x = 0; for (int i = 0; i < N; ++i) { cin >> x; ++A[x]; A[Range+1] += x; } for (int i = 0; i < N; ++i) { cin >> x; ++B[x]; B[Range+1] += x; } for (int i = Range+1; i > 0; --i) { if(A[i] > B[i]) { cout << "Algosia"; return(0); } if(A[i] < B[i]) { cout << "Bajtek"; return(0); } } 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 | #include<iostream> using namespace std; int A[21], B[21]; int main() { const int N = 18, Range = 10; int x = 0; for (int i = 0; i < N; ++i) { cin >> x; ++A[x]; A[Range+1] += x; } for (int i = 0; i < N; ++i) { cin >> x; ++B[x]; B[Range+1] += x; } for (int i = Range+1; i > 0; --i) { if(A[i] > B[i]) { cout << "Algosia"; return(0); } if(A[i] < B[i]) { cout << "Bajtek"; return(0); } } cout << "remis"; } |