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 <stdio.h>

#define MAX 18
#define RES 11

int main()
{
int n,A,B,HA[RES],HB[RES],RA,RB,algosia[MAX],bajtek[MAX];

	A = B = 0;
	for (n = 0; n < RES; n++) HA[n] = HB[n] = 0;
	
	for (n = 0; n < MAX; n++)
	{
		scanf("%d",algosia+n);
		A += algosia[n];
		HA[algosia[n]]++;
	}

	for (n = 0; n < MAX; n++) 
	{
		scanf("%d",bajtek+n);
		B += bajtek[n];
		HB[bajtek[n]]++;
	}

	RA = RB = 0;
	if (A > B) RA++; else if (B > A) RB++;
	for (n = 10; n >= 0; n--)
	{
		RA <<= 1;
		RB <<= 1;
		if (HA[n] > HB[n]) RA++; else if (HB[n] > HA[n]) RB++;
	}
	if (RA > RB) printf("Algosia\n"); else if (RB > RA) printf("Bajtek\n"); else printf("remis\n");
	

	return 0;
}