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
61
62
63
64
65
#include <stdio.h>
#include <stdint.h>
#include <string.h>

#define EX_NUM  (18u)
#define SCORE_NUM  (11u)

int main(void)
{   
    unsigned Algosia[EX_NUM] = {0u};
    unsigned Bajtek[EX_NUM] = {0u};
    uint8_t Algosia_scores[SCORE_NUM] = {0u};
    uint8_t Bajtek_scores[SCORE_NUM] = {0u};
    uint8_t A_score = 0u;
    uint8_t B_score = 0u;
    char winner[9] = {0};
    int i = 0;

    for(i = 0; i < EX_NUM; i++)
    {
        scanf("%u", Algosia + i);
        Algosia_scores[Algosia[i]]++;
        A_score += Algosia[i];
    }

    for(i = 0; i < EX_NUM; i++)
    {
        scanf("%u", Bajtek + i);
        Bajtek_scores[Bajtek[i]]++;
        B_score += Bajtek[i];
    }

    if (A_score > B_score)
    {
        strcpy(winner, "Algosia");
    }
    else if (A_score < B_score)
    {
        strcpy(winner, "Bajtek");
    }
    else
    {
        for (i = SCORE_NUM - 1; i >= 0 && !winner[0]; i--)
        {
            if (Algosia_scores[i] > Bajtek_scores[i])
            {
                strcpy(winner, "Algosia");
            }
            else if (Algosia_scores[i] < Bajtek_scores[i])
            {
                strcpy(winner, "Bajtek");
            }
        }
    }

    if (!winner[0])
    {
       strcpy(winner, "remis");
    }

    printf("%s", winner);
    

    return 0;
}