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

Problem_ID: D
Result: Accepted
Time: 1ms
Memory: 1208kB
In contest: 1075

#include <stdio.h>
#include<stdlib.h>

struct py
{
	int num;
	char name[21];
	int hms1;
	int hms2;
	int hms3;
	int lx1;
};
struct qq
{
	char tel[111][15];
	int lx[111];

};

int main()
{
	int n,j,k;
	struct py pen[111];
	struct qq q[111];
	scanf("%d",&n);
	for(j=0;j<n;j++)
	{
		scanf("%d %s",&pen[j].num,pen[j].name);
		//printf("%d %s\n",pen[j].num,pen[j].name);
		int i,f1=0,f2=0;
		pen[j].hms1=0,pen[j].hms2=0,pen[j].hms3=0;

		for(i=0;i<pen[j].num;i++)
		{
			scanf("%s",q[j].tel[i]);
			//printf("%s\n",q[j].tel[i]);

			if(q[j].tel[i][0]==q[j].tel[i][1]&&q[j].tel[i][1]==q[j].tel[i][3]&&q[j].tel[i][3]==q[j].tel[i][4]&&q[j].tel[i][4]==q[j].tel[i][6]&&q[j].tel[i][6]==q[j].tel[i][7])
				q[j].lx[i]=1,f1=1,pen[j].hms1++;
			else if(q[j].tel[i][0]>q[j].tel[i][1]&&q[j].tel[i][1]>q[j].tel[i][3]&&q[j].tel[i][3]>q[j].tel[i][4]&&q[j].tel[i][4]>q[j].tel[i][6]&&q[j].tel[i][6]>q[j].tel[i][7])
				q[j].lx[i]=2,f2=1,pen[j].hms2++;
			else
				q[j].lx[i]=3,pen[j].hms3++;
			//printf("%d\n",q[j].lx[i]);
		}
		if(pen[j].hms1>pen[j].hms2&&pen[j].hms1>pen[j].hms3)
			pen[j].lx1=1;
		else if(pen[j].hms2>pen[j].hms1&&pen[j].hms2>pen[j].hms3)
			pen[j].lx1=2;
		else if(pen[j].hms3>pen[j].hms1&&pen[j].hms3>pen[j].hms2)
			pen[j].lx1=3;


	}/*
	printf("If you want to have a keyboard, you should call:");
	int i;
	for(i=0;i<n;i++)
	{
		if(pen[i].lx1==1)
		printf("%s",pen[i].name);
	}printf("\n");

	printf("If you want to order a Watchdog2, you should call:");
	for(i=0;i<n;i++)
	{
		if(pen[i].lx1==2)
		printf("%s",pen[i].name);
	}printf("\n");

	printf("If you want to have a cup of coffee with a girl, you should call:");
	for(i=0;i<n;i++)
	{
		if(pen[i].lx1==3)
		printf("%s",pen[i].name);
	}printf("\n");*/




	k=0,j=0;  
	int a=pen[0].hms1,i;
	for(i=0;i<n;i++)
	{
		if(a<pen[i].hms1)
			a=pen[i].hms1,k++;
	}
	printf("If you want to have a keyboard, you should call:");
	for(i=0;i<n;i++)
	{
		
		if(a==pen[i].hms1)
		{
			if(j!=0)
				printf(",");
			printf(" %s",pen[i].name),j++;
		}
	}
	printf(".\n");

	k=0;a=pen[0].hms2,j=0;
	for(i=0;i<n;i++)
	{
		if(a<pen[i].hms2)
			a=pen[i].hms2,k++;
	}
	printf("If you want to order a Watchdog2, you should call:");
	for(i=0;i<n;i++)
	{
		
		if(a==pen[i].hms2)
			{
			if(j!=0)
				printf(",");
			printf(" %s",pen[i].name),j++;
		}
	}
	printf(".\n");

	k=0;a=pen[0].hms3,j=0;
	for(i=0;i<n;i++)
	{
		if(a<pen[i].hms3)
			a=pen[i].hms3,k++;
	}
	printf("If you want to have a cup of coffee with a girl, you should call:");
	for(i=0;i<n;i++)
	{
		
		if(a==pen[i].hms3)
			{
			if(j!=0)
				printf(",");
			printf(" %s",pen[i].name),j++;
		}
	}
	printf(".\n");
}