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
40
41
42
43
44
45
46
#include <iostream>
using namespace std;
int main()
{
    int alg[18];
    int baj[18];
    int sum1 = 0, sum2 = 0;
    for (int i = 0; i < 18; i++) {
        cin >> alg[i];
    }
    for (int i = 0; i < 18; i++) {
        cin >> baj[i];
    }
    for (int i = 0; i < 18; i++) {
        sum1 = sum1 + alg[i];
    }
    for (int i = 0; i < 18; i++) {
        sum2 = sum2 + baj[i];
    }
    if (sum1 > sum2)
        cout << "Algosia";
    else if (sum1 < sum2)
        cout << "Bajtek";
    else {      
        for (int j = 10; j > 0; j--) {
            sum1 = 0;
            sum2 = 0;
            for (int i = 0; i < 18; i++) {
                if (alg[i] == j)
                    sum1++;
                if (baj[i] == j)
                    sum2++;
            }
            if (sum1 > sum2) {
                cout << "Algosia";
                return 0;
            }
            if (sum1 < sum2) {
                cout << "Bajtek";
                return 0;
            }
        }
        cout << "remis";
    }
    return 0;
}