#include <iostream>
#include <fstream>
using namespace std;
int wyn1[11];
int wyn2[11];
int por(){
int suma1=0;
int suma2=0;
for(int i=0; i<=10; i++) suma1+=i*wyn1[i];
for(int i=0; i<=10; i++) suma2+=i*wyn2[i];
if(suma1>suma2) return 1;
if(suma1<suma2) return -1;
for(int i=10; i>=0; i--){
if(wyn1[i]>wyn2[i]) return 1;
if(wyn1[i]<wyn2[i]) return -1;
}
return 0;
}
int main()
{
for(int i=0; i<=10; i++){
wyn1[i]=0;
wyn2[i]=0;
}
int d;
for(int i=0; i<18; i++){
scanf("%d", &d);
wyn1[d]++;
}
for(int i=0; i<18; i++){
scanf("%d", &d);
wyn2[d]++;
}
switch(por()){
case 1:
printf("Algosia");
break;
case 0:
printf("remis");
break;
case -1:
printf("Bajtek");
break;
}
return 0;
}
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 | #include <iostream> #include <fstream> using namespace std; int wyn1[11]; int wyn2[11]; int por(){ int suma1=0; int suma2=0; for(int i=0; i<=10; i++) suma1+=i*wyn1[i]; for(int i=0; i<=10; i++) suma2+=i*wyn2[i]; if(suma1>suma2) return 1; if(suma1<suma2) return -1; for(int i=10; i>=0; i--){ if(wyn1[i]>wyn2[i]) return 1; if(wyn1[i]<wyn2[i]) return -1; } return 0; } int main() { for(int i=0; i<=10; i++){ wyn1[i]=0; wyn2[i]=0; } int d; for(int i=0; i<18; i++){ scanf("%d", &d); wyn1[d]++; } for(int i=0; i<18; i++){ scanf("%d", &d); wyn2[d]++; } switch(por()){ case 1: printf("Algosia"); break; case 0: printf("remis"); break; case -1: printf("Bajtek"); break; } return 0; } |
English