/* 2024
* Maciej Szeptuch
*/
#include <cstdio>
int score;
int algosia;
int bajtek;
int alg[16];
int baj[16];
const char *who_won(void);
int main(void)
{
for(int s = 0; s < 18; ++s)
{
scanf("%d", &score);
algosia += score;
++alg[score];
}
for(int s = 0; s < 18; ++s)
{
scanf("%d", &score);
bajtek += score;
++baj[score];
}
printf("%s\n", who_won());
return 0;
}
inline const char *who_won(void)
{
if(algosia > bajtek)
return "Algosia";
if(algosia < bajtek)
return "Bajtek";
for(int s = 10; s >= 0; --s)
{
if(alg[s] > baj[s])
return "Algosia";
if(alg[s] < baj[s])
return "Bajtek";
}
return "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 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 | /* 2024 * Maciej Szeptuch */ #include <cstdio> int score; int algosia; int bajtek; int alg[16]; int baj[16]; const char *who_won(void); int main(void) { for(int s = 0; s < 18; ++s) { scanf("%d", &score); algosia += score; ++alg[score]; } for(int s = 0; s < 18; ++s) { scanf("%d", &score); bajtek += score; ++baj[score]; } printf("%s\n", who_won()); return 0; } inline const char *who_won(void) { if(algosia > bajtek) return "Algosia"; if(algosia < bajtek) return "Bajtek"; for(int s = 10; s >= 0; --s) { if(alg[s] > baj[s]) return "Algosia"; if(alg[s] < baj[s]) return "Bajtek"; } return "remis"; } |
English