1299. Academy Awards Constraints
Time limit:1 secs, Memory limit:32 MB
Description
selected from 3,850 teams from 1,329 universities on countries competing at 106 sites and preliminary Contests worldwide, Sixty-eight teams competed for bragging rights and prizes at the 27th annual ACM International Collegi ATE programming Contest World Finals sponsored by IBM on March, 2003, in Hollywood, California. the 2003 World Cha Mpion is warsaw university. And zhongshanuniversity won the 8th place. During those days, another world famous event is held in the same place. It was the 75th annual Academy Awards. It ' s also known as Oscar.
We always say this best picture is the most important award of the awards. Before the Oscar night, we can ' t tell which film would win best picture. Fortunately, we can dope it out from the nominee List of all the awards and other than the best picture. I suggest that should follow my 3 rules here.
l all the films in the list has chances to Win the best picture
l the film which would win the best picture Is the film which have been nominated the most times in the list
l if there is more than one film which been nominated the most times in the list, we'll choose the first one which appears in the list
Let's see such a List below.
VISUAL EFFECTS The Lord of the rings:the-TOWERS Spider-man STAR WARS Episode II ATTACK of the Clones Sound EDITING The Lord of the Rings:the-TOWERS MINORITY Report ROAD to Perdition |
from The list, we can find That the Lord of the Rings:the and the towers has been nominated twice. And each of the other films have been nominated only once. So we can say the Lord of the Rings:the, towers would win the best P Icture.
Your task is-to-write a program-to-figure out the anticipatory-winner from the list.
Input
The input file is consist of several lists. The first line of each list contains only one integer n (1≤n≤100), representing the number of the awards in the list. Then you get n blocks. Each block indicated the nominees of a distinct award. The first line of each block was the name of the award which is not longer than 80. The second line is Mi (1≤m Sub style= "line-height:21.875px" >i ≤10, 1≤i≤n)- The number of nominated films. In the following lines is m i film names, One per line. The question simple, you can assume this there isn ' t any space in the film names.
The input is terminated by a line with one zero.
Output
For each list, you is supposed to figure out the winner of the best picture in a single line.
Sample Input
2visual_effects3the_lord_of_the_rings:_the_two_towersspider-manstar_wars_episode_ii_attack_of_the_clonessound_ Editing3the_lord_of_the_rings:_the_two_towersminority_reportroad_to_perdition0
Sample Output
The_lord_of_the_rings:_the_two_towers
Problem Source
ZSUACM Team Member
#include <stdio.h> #include <string.h>char films[1005][85];int main () {bool found; int blocks, names, M, I, times[1005], Max, POS; Char temp[85]; while (scanf ("%d", &blocks) && blocks) {memset (times, 0, sizeof (times)); memset (films, ' N ', sizeof (films)); names = 0; while (blocks--) {scanf ("%s", temp); scanf ("%d", &m); while (m--) {memset (temp, ' n ', sizeof (temp)); scanf ("%s", temp); for (i = 0, found = false; i < names; i++) {if (!strcmp (temp, films[i])) {T imes[i]++; Found = true; Break }} if (!found) {strcpy (films[names], temp); times[names++] = 1; }}} for (max = 0, pos = 0, i = 0; i < names; i++) {if (Times[i] > Max) {max = times[i]; pos = i; }} printf ("%s\n", Films[pos]); } return 0;}
Sicily 1299. Academy Awards