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<cstdio>
# include <iostream>
#include<string>
#define MAX 600
using namespace std;
struct fri{
	int m;
	string name;
	char num[MAX];
	int key;
	int wat;
	int coffee;
};
int main()
{
	int n;
	char c;
	int count;
	scanf("%d",&n);
	struct fri f[100];
	for(int i=0;i<n;i++){
		cin>>f[i].m;
		cin>>f[i].name;
		f[i].key=false;
		f[i].wat=false;
		f[i].coffee=false;
		for(int j=0;j<f[i].m;j++){
			cin>>f[i].num[j*6];
			cin>>f[i].num[j*6+1];
			cin>>c;
			cin>>f[i].num[j*6+2];
			cin>>f[i].num[j*6+3];
			cin>>c;
			cin>>f[i].num[j*6+4];
			cin>>f[i].num[j*6+5];
		}
		for(int h=0;h<f[i].m;h++){
			if(f[i].num[h*6]==f[i].num[h*6+1]&&f[i].num[h*6+2]==f[i].num[h*6+1]&&f[i].num[h*6+2]==f[i].num[h*6+3]&&f[i].num[h*6+3]==f[i].num[h*6+4]&&f[i].num[h*6+4]==f[i].num[h*6+5])
				f[i].key++;
			else if(f[i].num[h*6]>f[i].num[h*6+1]&&f[i].num[h*6+1]>f[i].num[h*6+2]&&f[i].num[h*6+2]>f[i].num[h*6+3]&&f[i].num[h*6+3]>f[i].num[h*6+4]&&f[i].num[h*6+4]>f[i].num[h*6+5])
				f[i].wat++;
			else
				f[i].coffee++;
		}
	}
	
	int r=0;
	for(int i=0;i<n;i++){
		if(f[i].key>r){
			r=f[i].key;
		}
	}
	printf("If you want to have a keyboard, you should call:");
	int ch=0;
	count=0;
		for(int i=0;i<n;i++){
			if(f[i].key==r){
				if(count==0)
					cout<<" "<<f[i].name;//printf(" %s",f[i].name);
				else
					cout<<", "<<f[i].name;//printf("%s",f[i].name);
				count++;
			}
		}
			printf(".\n");

	r=0;
	for(int i=0;i<n;i++){
		if(f[i].wat>r){
			r=f[i].wat;
		}
	}
		printf("If you want to order a Watchdog2, you should call:");
		count=0;
		for(int i=0;i<n;i++){
			if(f[i].wat==r){
				if(count==0)
					cout<<" "<<f[i].name;//printf(" %s",f[i].name);
				else
					cout<<", "<<f[i].name;//printf("%s",f[i].name);
				count++;
			}
		}
			printf(".\n");



	r=0;
	count=0;
	for(int i=0;i<n;i++){
		if(f[i].coffee>r){
			r=f[i].coffee;
		}
	}
		printf("If you want to have a cup of coffee with a girl, you should call:");
		for(int i=0;i<n;i++){
			if(f[i].coffee==r){
				if(count==0)
					cout<<" "<<f[i].name;//printf(" %s",f[i].name);
				else
					cout<<", "<<f[i].name;//printf("%s",f[i].name);
				count++;
			}
		}
		printf(".");
	return 0;
}