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 <stdlib.h>
#include <string.h>

typedef struct people{
	int kb;
	int wd;
	int cc;
	char name[21];
}PEOPLE;

int main()
{
	int t, i, n, j, m, x, y, z, kbs = 0, wds = 0, ccs = 0;
	int kbmax[100] = {0}, wdmax[100] = {0}, ccmax[100] = {0};
	PEOPLE a[100];
	scanf("%d", &n);
	for (i = 0; i < n; i++)
	{
		a[i].kb = 0;
		a[i].wd = 0;
		a[i].cc = 0;
		scanf("%d%s%*c", &m, a[i].name);
		for (j = 0; j < m; j++)
		{
			scanf("%d-%d-%d", &x, &y, &z);
			if (x == y && y == z)
			{
				a[i].kb++;
			}
			else
			{
				if (x / 10 > x % 10 && x % 10 > y / 10 && y / 10 > y % 10 && y % 10 > z / 10 && z / 10 > z % 10) 
				{
					a[i].wd++;
				}
				else
				{
					a[i].cc++;
				}
			}
		}
		if (i != 0)
		{
			if (a[i].kb == a[kbmax[0]].kb)
			{
				kbmax[kbs] = i;
				kbs++;
			}
			else
			{
				if (a[i].kb > a[kbmax[0]].kb)
				{
					kbmax[0] = i;
					kbs = 1;
				}
			}
			
			if (a[i].wd == a[wdmax[0]].wd)
			{
				wdmax[wds] = i;
				wds++;
			}
			else
			{
				if (a[i].wd > a[wdmax[0]].wd)
				{
					wdmax[0] = i;
					wds = 1;
				}
			}
			
			if (a[i].cc == a[ccmax[0]].cc)
			{
				ccmax[ccs] = i;
				ccs++;
			}
			else
			{
				if (a[i].cc > a[ccmax[0]].cc)
				{
					ccmax[0] = i;
					ccs = 1;
				}
			}
		}
		else
		{
			kbmax[0] = 0;
			wdmax[0] = 0;
			ccmax[0] = 0;
			kbs = 1;
			wds = 1;
			ccs = 1;
		}
	}

	
	printf("If you want to have a keyboard, you should call: ");
	for (i = 0; i < kbs; i++)
	{
		if (i == kbs - 1)
		{
			printf("%s.\n", a[kbmax[i]].name);
		}
		else
		{
			printf("%s, ", a[kbmax[i]].name);
		}
	}
	
	printf("If you want to order a Watchdog2, you should call: ");
	for (i = 0; i < wds; i++)
	{
		if (i == wds - 1)
		{
			printf("%s.\n", a[wdmax[i]].name);
		}
		else
		{
			printf("%s, ", a[wdmax[i]].name);
		}
	}
	
	printf("If you want to have a cup of coffee with a girl, you should call: ");
	for (i = 0; i < ccs; i++)
	{
		if (i == ccs - 1)
		{
			printf("%s.\n", a[ccmax[i]].name);
		}
		else
		{
			printf("%s, ", a[ccmax[i]].name);
		}
	}
	return 0;
}