Sicily 1299. Academy Awards

1299. Academy AwardsConstraints

Time Limit: 1 secs, Memory Limit: 32 MB

Description

Selected from 3,850 teams from 1,329 universities in 68 countries competing at 106 sites and preliminary contests worldwide, sixty-eight teams competed for bragging rights and prizes at The 27th Annual ACM International Collegiate Programming Contest World Finals sponsored by IBM on March 25, 2003, in Hollywood, California.The 2003 World Champion isWarsawUniversity . AndZhongshanUniversity won the 8thplace. During those days, another world famous event was held in the same place. It was the 75thAnnual Academy Awards. It’s also known as Oscar.

We always say that the Best Picture is the most important award of all the awards. Before the Oscar Night, we can’t tell which film will win Best Picture. Fortunately, we can dope it out from the Nominee List of all the awards other than the Best Picture. I suggest that you should follow my 3 rules here.

lAll the films in the list have chances to win the Best Picture

lThe film which will win the Best Picture is the film which has been nominated the most times in the list

lIf there are more than one film which have been nominated the most times in the list, we will choose the first one which appears in the list

Let’s see such a List below.

VISUAL EFFECTS

THE LORD OF THE RINGS: THETWOTOWERS

SPIDER-MAN

STAR WARS EPISODE II ATTACK OF THE CLONES

SOUND EDITING

THE LORD OF THE RINGS: THETWOTOWERS

MINORITY REPORT

ROAD TO PERDITION

From the list, we can find thatTHE LORD OF THE RINGS: THE TWO TOWERShas been nominated twice. And each of the other films has been nominated only once. So we can sayTHE LORD OF THE RINGS: THE TWO TOWERSwill win the Best Picture.

Your task is to write a program to figure out the anticipatory winner from the list.

Input

The input file will consist of several lists. The first line of each list contains only one integer n (1≤n≤100), representing the number of awards in the list. Then you get n blocks. Each block indicated the nominees of a distinct award. The first line of each block is the name of the award which is not longer than 80. The second line is mi(1≤mi≤10, 1≤i≤n) – the number of nominated films. In the following lines are mifilm names, one per line. For make the question simple, you can assume that there isn’t any space in the film names.

The input is terminated by a line with one zero.

Output

For each list, you are supposed to figure out the winner of Best Picture in a single line.

Sample Input2VISUAL_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_PERDITION0Sample OutputTHE_LORD_OF_THE_RINGS:_THE_TWO_TOWERSProblem 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, '\0', sizeof(films));names = 0;while (blocks–) {scanf("%s", temp);scanf("%d", &m);while (m–) {memset(temp, '\0', sizeof(temp));scanf("%s", temp);for (i = 0, found = false; i < names; i++) {if (!strcmp(temp, films[i])) {times[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

相关文章:

你感兴趣的文章:

标签云: