Start: Dec, 04, 2016 12:00:00
杭州师范大学第十届程序设计竞赛—正式
End: Dec, 04, 2016 17:00:00
Time elapsed:
Time remaining:

Problem_ID: D
Result: Accepted
Time: 0ms
Memory: 1096kB
In contest: 1075

#include<stdio.h>
struct fff
{
	int m;
	char name[25];
	char num[105][9];
};
void main()
{
	int n,i,j,a[1000],b[1000],c[1000];
	int z1,z2,z3,z4,z5,z6,x1,x2,x3;
	scanf("%d",&n);
	struct fff hch[101];
	for(i=0;i<n;i++)
	{
		int count1=0,count2=0,count3=0;
		scanf("%d %s",&hch[i].m,hch[i].name);
		for(j=0;j<hch[i].m;j++)
		{
			scanf("%s",hch[i].num[j]);
			z1=hch[i].num[j][0]-'0'+0;
			z2=hch[i].num[j][1]-'0'+0;
			z3=hch[i].num[j][3]-'0'+0;
			z4=hch[i].num[j][4]-'0'+0;
			z5=hch[i].num[j][6]-'0'+0;
			z6=hch[i].num[j][7]-'0'+0;
			x1=z1*10+z2;x2=z3*10+z4;x3=z5*10+z6;
			if(x1==x2&&x2==x3)
				count1++;
			else if(x1>x2&&x2>x3&&z1>z2&&z3>z4&&z5>z6)
				count2++;
			else count3++;

		}
		a[i]=count1;
		b[i]=count2;
		c[i]=count3;
	}
	int max1=0,max2=0,max3=0,sum1=0,sum2=0,sum3=0;
	for(i=0;i<n;i++)
	{
		if(a[i]>max1) max1=a[i];
		if(b[i]>max2) max2=b[i];
		if(c[i]>max3) max3=c[i];

	}
	for(i=0;i<n;i++)
	{
		if(a[i]==max1)
			sum1++;
			//printf("If you want to have a keyboard, you should call:%s.\n",hch[i].name);
		if(b[i]==max2)
			sum2++;
			//printf("If you want to order a Watchdog2, you should call:%s.\n",hch[i].name);
		if(c[i]==max3)
			sum3++;
			//printf("If you want to have a cup of coffee with a girl, you should call:%s.\n",hch[i].name);

	}
	int sum11=0,sum22=0,sum33=0;
	for(i=0;i<n;i++)
	{
		if(a[i]==max1)
		{
			sum11++;
			if(sum1==1)
			{
				printf("If you want to have a keyboard, you should call: %s.\n",hch[i].name);
				break;
			}

			else if(sum11==1)
		printf("If you want to have a keyboard, you should call: %s",hch[i].name);
			else if(sum11<sum1) printf(", %s",hch[i].name);
			else if(sum11==sum1) printf(", %s.\n",hch[i].name);
		}
	}
	for(i=0;i<n;i++)
	{
		if(b[i]==max2)
		{
			sum22++;
			if(sum2==1)
			{
				printf("If you want to order a Watchdog2, you should call: %s.\n",hch[i].name);
				break;
			}
			else if(sum22==1)
		printf("If you want to order a Watchdog2, you should call: %s",hch[i].name);
			else if(sum22<sum2) printf(", %s",hch[i].name);
			else if(sum22==sum2) printf(", %s.\n",hch[i].name);
		}
	}
	for(i=0;i<n;i++)
	{
		if(c[i]==max3)
		{
			sum33++;
			if(sum3==1)
			{
				printf("If you want to have a cup of coffee with a girl, you should call: %s.\n",hch[i].name);
				break;
			}
			else if(sum33==1)
		printf("If you want to have a cup of coffee with a girl, you should call: %s",hch[i].name);
			else if(sum33<sum3) printf(", %s",hch[i].name);
			else if(sum33==sum3) printf(", %s.\n",hch[i].name);
		}
	}

}