Result: Accepted
Time: 1ms
Memory: 1096kB
#include<stdio.h>
#include<stdlib.h>
struct abc{
char name[100];
int num1;
int num2;
int num3;
};
int main(void){
struct abc abcArray[200];
struct abc max1Array;
struct abc max2Array;
struct abc max3Array;
int T;
int a[200];
char b[200][10];
char s[10];
int i,j;
int n1=0,n2=0,n3=0;
int n4=0,n5=0,n6=0;
scanf("%d",&T);
for(i=0;i<T;i++){
abcArray[i].num1=0;
abcArray[i].num2=0;
abcArray[i].num3=0;
}
for(i=0;i<T;i++){
scanf("%d %s",&a[i],abcArray[i].name);
for(j=0;j<a[i];j++){
scanf("%s",b[j]);
if(b[j][0]==b[j][1] && b[j][1]==b[j][3] && b[j][3]==b[j][4] && b[j][4]==b[j][6] && b[j][6]==b[j][7])
abcArray[i].num1+=1;
else if(b[j][0]>b[j][1] && b[j][1]>b[j][3] && b[j][3]>b[j][4] && b[j][4]>b[j][6] && b[j][6]>b[j][7])
abcArray[i].num2+=1;
else
abcArray[i].num3+=1;
}
}
max1Array=abcArray[0];
for(i=0;i<T;i++){
if(max1Array.num1<abcArray[i].num1)
max1Array=abcArray[i];
}
printf("If you want to have a keyboard, you should call: ");
for(i=0;i<T;i++){
if(abcArray[i].num1==max1Array.num1)
n1++;
}
for(i=0;i<T;i++){
if(abcArray[i].num1==max1Array.num1){
n4++;
if(n4<n1)
printf("%s, ",abcArray[i].name);
else
printf("%s.\n",abcArray[i].name);
}
}
max2Array=abcArray[0];
for(i=0;i<T;i++){
if(max2Array.num2<abcArray[i].num2)
max2Array=abcArray[i];
}
printf("If you want to order a Watchdog2, you should call: ");
for(i=0;i<T;i++){
if(abcArray[i].num2==max2Array.num2)
n2++;
}
for(i=0;i<T;i++){
if(abcArray[i].num2==max2Array.num2){
n5++;
if(n5<n2)
printf("%s, ",abcArray[i].name);
else
printf("%s.\n",abcArray[i].name);
}
}
max3Array=abcArray[0];
for(i=0;i<T;i++){
if(max3Array.num3<abcArray[i].num3)
max3Array=abcArray[i];
}
printf("If you want to have a cup of coffee with a girl, you should call: ");
for(i=0;i<T;i++){
if(abcArray[i].num3==max3Array.num3)
n3++;
}
for(i=0;i<T;i++){
if(abcArray[i].num3==max3Array.num3){
n6++;
if(n6<n3)
printf("%s, ",abcArray[i].name);
else
printf("%s.\n",abcArray[i].name);
}
}
}