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>
#include<stdlib.h>
#include<string.h>
struct person{
	int num;
	char name[21];
	char number[101][9];
	int equal;
	int min;
	int max;
};
int main()
{
	int n;
	scanf("%d", &n);
	int nn=n;
	struct person a[101];
	int t=0, max1=0, max2=0, max3=0;
	while(n--)
	{
		scanf("%d %s", &a[t].num, a[t].name);
		a[t].equal=0, a[t].min=0, a[t].max=0;
		for(int i=0; i<a[t].num; i++)
		{
			scanf("%s", a[t].number[i]);
			if(a[t].number[i][0]==a[t].number[i][1]&&a[t].number[i][1]==a[t].number[i][3]&&a[t].number[i][3]==a[t].number[i][4]
			&&a[t].number[i][4]==a[t].number[i][6]&&a[t].number[i][6]==a[t].number[i][7])
			{
				a[t].equal++;
				if(max1<a[t].equal)
					max1=a[t].equal;
			}
			else if(a[t].number[i][0]>a[t].number[i][1]&&a[t].number[i][1]>a[t].number[i][3]&&a[t].number[i][3]>a[t].number[i][4]
			&&a[t].number[i][4]>a[t].number[i][6]&&a[t].number[i][6]>a[t].number[i][7])
			{
				a[t].min++;
				if(max2<a[t].min)
					max2=a[t].min;
			}
			else
			{
				a[t].max++;
				if(max3<a[t].max)
					max3=a[t].max;
			}
		}
		t++;
	}
	int count1=0, count2=0, count3=0;
	for(int i=0; i<nn; i++)
	{
		if(a[i].equal==max1)
			count1++;
		if(a[i].min==max2)
			count2++;
		if(a[i].max==max3)
			count3++;
	}

	printf("If you want to have a keyboard, you should call: ");
	for(int i=0; i<nn; i++)
	{
		if(a[i].equal==max1)
		{
			for(int j=0;j<strlen(a[i].name); j++)
				printf("%c",a[i].name[j]);
			count1--;
			if(count1!=0)
				printf(", ");
			else
				printf(".\n");
		}

	}
	printf("If you want to order a Watchdog2, you should call: ");
	for(int i=0; i<nn; i++)
	{
		if(a[i].min==max2)
		{
			for(int j=0;j<strlen(a[i].name); j++)
				printf("%c",a[i].name[j]);
			count2--;
			if(count2!=0)
				printf(", ");
			else
				printf(".\n");
		}

	}
	printf("If you want to have a cup of coffee with a girl, you should call: ");
	for(int i=0; i<nn; i++)
	{
		if(a[i].max==max3)
		{
			for(int j=0;j<strlen(a[i].name); j++)
				printf("%c",a[i].name[j]);
			count3--;
			if(count3!=0)
				printf(", ");
			else
				printf(".\n");
		}

	}

}