Result: Accepted
Time: 1ms
Memory: 1096kB
#include <stdio.h>
#include <stdlib.h>
struct ren
{
char name[66];
int fuwu1;
int fuwu2;
int fuwu3;
};
int main ()
{
int t;
int i,k;
char a,b,c,d,e,f;
int f1m,f2m,f3m;
int flag;
struct ren list[666];
scanf("%d",&t);
f1m = f2m = f3m =0;
for(i=0;i<=t-1;i++)
{
scanf("%d",&k);
getchar();
scanf("%s",&list[i].name);
list[i].fuwu1=0;
list[i].fuwu2=0;
list[i].fuwu3=0;
while(k--)
{
getchar();
scanf("%c%c-%c%c-%c%c",&a,&b,&c,&d,&e,&f);
if(a==b&&b==c&&c==d&&d==e&&e==f)
{
list[i].fuwu1++;
}
else if(a>b&&b>c&&c>d&&d>e&&e>f)
{
list[i].fuwu2++;
}
else
{
list[i].fuwu3++;
}
}
if(f1m<list[i].fuwu1)
{
f1m=list[i].fuwu1;
}
if(f2m<list[i].fuwu2)
{
f2m=list[i].fuwu2;
}
if(f3m<list[i].fuwu3)
{
f3m=list[i].fuwu3;
}
}
printf("If you want to have a keyboard, you should call: ");
flag = 0;
for(i=0;i<=t-1;i++)
{
if(flag==0)
{
if(list[i].fuwu1==f1m)
{
printf("%s",list[i].name);
flag++;
}
}
else
{
if(list[i].fuwu1==f1m)
{
printf(", %s",list[i].name);
}
}
}
printf(".\n");
printf("If you want to order a Watchdog2, you should call: ");
flag = 0;
for(i=0;i<=t-1;i++)
{
if(flag==0)
{
if(list[i].fuwu2==f2m)
{
printf("%s",list[i].name);
flag++;
}
}
else
{
if(list[i].fuwu2==f2m)
{
printf(", %s",list[i].name);
}
}
}
printf(".\n");
printf("If you want to have a cup of coffee with a girl, you should call: ");
flag = 0;
for(i=0;i<=t-1;i++)
{
if(flag==0)
{
if(list[i].fuwu3==f3m)
{
printf("%s",list[i].name);
flag++;
}
}
else
{
if(list[i].fuwu3==f3m)
{
printf(", %s",list[i].name);
}
}
}
printf(".\n");
}