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

#include<iostream>
#include<cstdlib>
#include<cmath>
#include<cstring>
#include<iomanip>
#include<algorithm>
using namespace std;
struct cc{
	char name[100];
	int ph[101][6];
	int flag[4];
};
int main()
{
	int n;
	cin>>n;
	cc g[101];
	for(int i=0;i<n;i++)
	{
		int m;
		cin>>m;
		
		cin>>g[i].name;
		memset(g[i].flag,0,sizeof(g[i].flag));
		for(int j=0;j<m;j++)
		{
			int c=0;
			for(int t=0;t<8;t++)
			{
				char x;
				cin>>x;
				if(x!='-')
				{
					g[i].ph[j][c++]=x-'0';
				}
			}
			if(g[i].ph[j][5]<g[i].ph[j][4]&&g[i].ph[j][4]<g[i].ph[j][3]&&g[i].ph[j][3]<g[i].ph[j][2]&&g[i].ph[j][2]<g[i].ph[j][1]&&g[i].ph[j][1]<g[i].ph[j][0])
			{
				g[i].flag[2]++;
			}else if(g[i].ph[j][5]==g[i].ph[j][4]&&g[i].ph[j][4]==g[i].ph[j][3]&&g[i].ph[j][3]==g[i].ph[j][2]&&g[i].ph[j][2]==g[i].ph[j][1]&&g[i].ph[j][1]==g[i].ph[j][0])
			{
				g[i].flag[1]++;
			}else
			{
				g[i].flag[3]++;
			}
			
		}
//		cout<<g[i].flag[1]<<g[i].flag[2]<<g[i].flag[3]<<endl;
	}
	cout<<"If you want to have a keyboard, you should call: ";
	int has=0;
	int max1=0,max2=0,max3=0;
	for(int i=0;i<n;i++)
	{
		if(g[i].flag[1]>max1)
		{
			max1=g[i].flag[1];
		}
		if(g[i].flag[2]>max2)
		{
			max2=g[i].flag[2];
		}
		if(g[i].flag[3]>max3)
		{
			max3=g[i].flag[3];
		}
	}
	for(int i=0;i<n;i++)
	{
		if(g[i].flag[1]==max1&&has==0)
		{
			cout<<g[i].name;
			has=1;
		}else if(g[i].flag[1]==max1&&has)
		{
			cout<<", "<<g[i].name;
		}
	}
	cout<<"."<<endl;
	cout<<"If you want to order a Watchdog2, you should call: ";
	has=0;
	for(int i=0;i<n;i++)
	{
		if(g[i].flag[2]==max2&&has==0)
		{
			cout<<g[i].name;
			has=1;
		}else if(g[i].flag[2]==max2&&has)
		{
			cout<<", "<<g[i].name;
		}
	}
	cout<<"."<<endl;
	cout<<"If you want to have a cup of coffee with a girl, you should call: ";
	has=0;
	for(int i=0;i<n;i++)
	{
		if(g[i].flag[3]==max3&&has==0)
		{
			cout<<g[i].name;
			has=1;
		}else if(g[i].flag[3]==max3&&has)
		{
			cout<<", "<<g[i].name;
		}
	}
	cout<<"."<<endl;
	
}