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>
#include <string.h>
#include<stdlib.h>
#define max(a,b) (a)>(b)?(a):(b)

int main(){
	int count;
	int n,m;
	int temp;
	char tempphone[20];
	int countcoffee=0,countgame=0,countkey=0;
	int i=0,j,maxcoffee,maxgame,maxkey;
	int coffeeid=0,keyid=0,gameid=0;
	struct phonenumber {
		char name[21];
		int coffee,game,key;
	} fris[101];

	scanf("%d",&n);
	maxcoffee=0;
	maxgame=0;
	maxkey=0;

	for (i=1;i<=n;i++){
		scanf("%d%s",&temp,fris[i].name);
		fris[i].game=0;fris[i].key=0;fris[i].coffee=0;
		for (j=1;j<=temp;j++){
			scanf("%s",tempphone);
			{if (tempphone[0]==tempphone[1]&&tempphone[1]==tempphone[3]&&tempphone[3]==tempphone[4]&&tempphone[4]==tempphone[6]&&tempphone[6]==tempphone[7])
			fris[i].key++;

			else if(tempphone[0]>tempphone[1]&&tempphone[1]>tempphone[3]&&tempphone[3]>tempphone[4]&&tempphone[4]>tempphone[6]&&tempphone[6]>tempphone[7])
			fris[i].game++;
			
			else 
				fris[i].coffee++;
			}
		

		}
		if(fris[i].game>maxgame){
				maxgame=fris[i].game;
				countgame=1;
				gameid=i;
			}

			else if (fris[i].game==maxgame){
				countgame++;
			}
		
			if(fris[i].key>maxkey){
				maxkey=fris[i].key;
				keyid=i;
				countkey=1;
			
			}
			else if (fris[i].key==maxkey){
				countkey++;
			}
		
			
			if(fris[i].coffee>maxcoffee){
				maxcoffee=fris[i].coffee;
				countcoffee=1;
				coffeeid=i;
			}

			else if (fris[i].coffee==maxcoffee){
				countcoffee++;
			}
	}


	count=0;
	printf("If you want to have a keyboard, you should call: ");
	for (i=1;i<=n;i++){
		if(fris[i].key==maxkey){

			printf("%s",fris[i].name);
			count++;
			if(count==countkey)
				printf(".\n");
			else 
				printf(", ");
	}

	}
	count=0;
	printf("If you want to order a Watchdog2, you should call: ");
	for (i=1;i<=n;i++){
		if(fris[i].game==maxgame){
			
			printf("%s",fris[i].name);
			count++;
		
			if(count==countgame)
				printf(".\n");
			else 
				printf(", ");
		}

		}
	
	count=0;
	printf("If you want to have a cup of coffee with a girl, you should call: ");
	for (i=1;i<=n;i++){
		if(fris[i].coffee==maxcoffee){

			printf("%s",fris[i].name);
			count++;
		
			if(count==countcoffee)
				printf(".");
			else 
				printf(", ");

		}
		}
	
	
	

	return 0;
}