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: 1096kB
In contest: 1075

#include<stdio.h>
void main(){
	int t,t1;
	char temp;
	int l = 0;
	int max = 0;
	int b[101][3];
	char name[101][21];	
	for(int i = 0;i < 101;i++)
		for(int j = 0;j< 3;j++)
			b[i][j] = 0;
	int i = 0 ;
	scanf("%d",&t);
	t1=t;
	while(t--){
		int n;
		
		scanf("%d",&n);
		scanf("%s",name[t]);
		scanf("%c",&temp);
		while(n--){
			char a[7];
			for(int i= 0,j = 0;i < 8;i++)
			{
				if(i == 2||i == 5)
					scanf("%c",&temp);
				else
				{
					scanf("%c",&a[j]);
					j++;
				}
			}	
			scanf("%c",&temp);
			for( i = 0;i < 5 ;i++)
				if(a[i]-a[i+1] !=0)
					break;
			if(i==5)
			{
				b[t][0]++;	
				continue;
			}
			for( i = 0;i < 5 ;i++)
				if(a[i+1]-a[i] >=0)
					break;
			if(i==5)
			{
				b[t][1]++;
				continue;
			}
			b[t][2]++;
		}
	}
	printf("If you want to have a keyboard, you should call:");
	for(int i = 0;i < t1;i++)
		if(b[i][0] > max)
			max = b[i][0];
	for(int i = t1-1;i >=0;i--)
		if(max == b[i][0])
		{
			if(l == 0)
			printf(" %s",name[i]);
			else
			printf(", %s",name[i]);
			l++;
		}
		printf(".\n");
	max = 0;
	l = 0;
	printf("If you want to order a Watchdog2, you should call:");
	for(int i = 0;i < t1;i++)
		if(b[i][1] > max)
			max = b[i][1];
	for(int i = t1-1;i >=0;i--)
		if(max == b[i][1])
		{
			if(l == 0)
			printf(" %s",name[i]);
			else
			printf(", %s",name[i]);
			l++;
		}
		printf(".\n");
	max = 0;
	l = 0;
	printf("If you want to have a cup of coffee with a girl, you should call:");
	for(int i = 0;i < t1;i++)
		if(b[i][2] > max)
			max = b[i][2];
	for(int i = t1-1;i >=0;i--)
		if(max == b[i][2])
		{
			if(l == 0)
			printf(" %s",name[i]);
			else
			printf(", %s",name[i]);
			l++;
		}
		printf(".\n");
}