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

#include<iostream>
#include<cstdlib>
#include<cstdio>
#include<cstring>
using namespace std;
int comp(const void*a,const void*b){
	return (*(char*)b-*(char*)a);
}
struct stu{
	char name[50];
	int key,game,coffee;
};
int iskey(char*s){
	if(s[0]==s[1]&&s[0]==s[3]&&s[0]==s[4]&&s[0]==s[6]&&s[0]==s[7])
		return 1;
	else return 0;
}
int isgame(char*s){
	if(s[0]>s[1]&&s[1]>s[3]&&s[3]>s[4]&&s[4]>s[6]&&s[6]>s[7])
		return 1;
	else return 0;
}
int main(){
	int x,i,n;
	char num[1000];
	struct stu data[50];
	cin>>x;
	for(i=0;i<x;++i){
		scanf("%d%s",&n,data[i].name);
		getchar();
		data[i].key=0,data[i].game=0,data[i].coffee=0;
		while(n--){
			gets(num);
			if(iskey(num)) data[i].key ++;
			else if(isgame(num)) data[i].game ++;
			else data[i].coffee++;
		}
	}
	int maxk=-1,maxg=-1,maxc=-1;
	for(i=0;i<x;++i){
		if(data[i].key>maxk) maxk=data[i].key;
		if(data[i].game>maxg) maxg=data[i].game;
		if(data[i].coffee>maxc) maxc=data[i].coffee;	
	}
	int kn=0,gn=0,cn=0;
	for(i=0;i<x;++i){
		if(data[i].key==maxk) kn++;
		if(data[i].game==maxg) gn++;
		if(data[i].coffee==maxc) cn++;
	}
	cout<<"If you want to have a keyboard, you should call:";
	for(i=0;i<x;++i){
		if(data[i].key==maxk) {
			printf(" %s",data[i].name);kn--;
			if(kn)printf(",");
			else printf(".\n");
		}
	}
	cout<<"If you want to order a Watchdog2, you should call:";
	for(i=0;i<x;++i){
		if(data[i].game==maxg) {
			printf(" %s",data[i].name);gn--;
			if(gn)printf(",");
			else printf(".\n");
		}
	}
	cout<<"If you want to have a cup of coffee with a girl, you should call:";
	for(i=0;i<x;++i){
		if(data[i].coffee ==maxc) {
			printf(" %s",data[i].name);cn--;
			if(cn)printf(",");
			else printf(".\n");
		}
	}
}