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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
#include <iostream>

using namespace std;

int main()
{
    int n = 18;
    int algosia[18];
    int bajtek[18];
    for (int i = 0; i < n; i++)
        cin >> algosia[i];

    for (int i = 0;  i < n; i++)
        cin >> bajtek[i];

    int suma1 = 0;
    int suma2 = 0;
    int tab1[11] = {0};
    int tab2[11] = {0};
    for (int i = 0; i < n; i++)
    {
        suma1 += algosia[i];
        suma2 += bajtek[i];
    }
    if (suma1 > suma2)
    {
        cout << "Algosia";
        return 0;
    }
    else if (suma2 > suma1)
    {
        cout << "Bajtek";
        return 0;
    }
    else if (suma2 == suma1)
    {
        for (int i = 0; i < n; i++)
        {
            tab1[algosia[i]]++;
            tab2[bajtek[i]]++;
        }
        for (int i = 10; i > 0; i--)
        {
            if (tab1[i] > tab2[i])
            {
                cout <<  "Algosia";
                return 0;
            }
            if (tab2[i] > tab1[i])
            {
                cout << "Bajtek";
                return 0;
            }
        }
        cout << "remis";
    }


    return 0;
}