Problem Description
Contest time again! How excited it is to see balloons floating around. But to tell you a secret, the judges' favorite time is guessing the most popular problem. When the contest is over, they will count the balloons of each color and find the result.

This year, they decide to leave this lovely job to you.

 
Input
Input contains multiple test cases. Each test case starts with a number N (0 < N <= 1000) -- the total number of balloons distributed. The next N lines contain one color each. The color of a balloon is a string of up to 15 lower-case letters.

A test case with N = 0 terminates the input and this test case is not to be processed.

 
Output
For each case, print the color of balloon for the most popular problem on a single line. It is guaranteed that there is a unique solution for each test case.
 
Sample Input
5
green
red
blue
red
red
3
pink
orange
pink
0
 
Sample Output
red
pink
 
Author
WU, Jiazhi
#include<cstdio>
#include<cstring>
int main()
{
char s[][];
char temp[];
int a[];
int n,i,j;
while()
{
memset(a,,sizeof(a));
memset(temp,,sizeof(temp));
memset(s,,sizeof(s));
scanf("%d",&n);
if(!n) break;
for(i=; i<n; i++)
scanf("%s",s[i]);
for(i=; i<n-; i++)
{
if(a[i]<) continue;/*不这样做就会超时*/
for(j=i+; j<n; j++)
{
if(a[j]<) continue;
if(strcmp(s[i],s[j])==)
{
a[i]++;
a[j]=-;
strcpy(s[j],temp);
} }
}
int max=,maxi=;
for(i=; i<n; i++)
if(a[i]>max)
{
max=a[i];
maxi=i;
}
printf("%s\n",s[maxi]); }
}

Let the Balloon Rise的更多相关文章

  1. hdu 1004 Let the Balloon Rise

    Let the Balloon Rise Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Oth ...

  2. Let the Balloon Rise 分类: HDU 2015-06-19 19:11 7人阅读 评论(0) 收藏

    Let the Balloon Rise Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Oth ...

  3. HDU 1004 Let the Balloon Rise map

    Let the Balloon Rise Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Oth ...

  4. HDU1004 Let the Balloon Rise(map的简单用法)

    Let the Balloon Rise Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others ...

  5. HD1004Let the Balloon Rise

    Let the Balloon Rise Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others ...

  6. Let the Balloon Rise(map)

    Let the Balloon Rise Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Oth ...

  7. akoj-1073- Let the Balloon Rise

    Let the Balloon Rise Time Limit:1000MS  Memory Limit:65536K Total Submit:92 Accepted:58 Description ...

  8. HDU 1004 Let the Balloon Rise【STL<map>】

    Let the Balloon Rise Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Oth ...

  9. Let the Balloon Rise(水)

    题目连接:http://acm.hdu.edu.cn/showproblem.php?pid=1004 Let the Balloon Rise Time Limit: 2000/1000 MS (J ...

  10. ACM Let the Balloon Rise

    Contest time again! How excited it is to see balloons floating around. But to tell you a secret, the ...

随机推荐

  1. cf.295.C.DNA Alignment(数学推导)

    DNA Alignment time limit per test 2 seconds memory limit per test 256 megabytes input standard input ...

  2. Linux守护进程的启动方法

    导读 “守护进程”(daemon)就是一直在后台运行的进程(daemon),通常在系统启动时一同把守护进程启动起来,本文介绍如何将一个 Web 应用,启动为守护进程. 一.问题的由来 Web应用写好后 ...

  3. hiho一下 第九十五周 数论四·扩展欧几里德

    题目 : 数论四·扩展欧几里德 时间限制:10000ms 单点时限:1000ms 内存限制:256MB 描述 小Hi和小Ho周末在公园溜达.公园有一堆围成环形的石板,小Hi和小Ho分别站在不同的石板上 ...

  4. 右移>> 和 左移<<

    一个int占四个字节,也就是32位,这样的话1不论左移还是右移32位仍旧移到原来的位置,就仍旧是1了. 右移是除,左移是乘.1除1除32次和1乘1乘32次当然都还是1了. 移位操作的简单计算方法 &g ...

  5. 【VirtualBox】VirtualBox的桥接网络模式,为啥网络不稳定?

    网桥模式访问外网非常慢,经常卡死,ping时断时续 七搞八搞,反复重启了几次 TMD  就好了,也不知道什么情况,VirtualBox还是不太好使啊..... 网桥模式 设置 如下: 参考资料: ht ...

  6. 《ASP.NET1200例》统计网站访问量源代码

    void Application_Start(object sender, EventArgs e)     {        //在应用程序启动时运行的代码        int count=0;  ...

  7. Android Unlock Patterns

    Given an Android 3x3 key lock screen and two integers m and n, where 1 ≤ m ≤ n ≤ 9, count the total ...

  8. Recover Rotated Sorted Array

    Given a rotated sorted array, recover it to sorted array in-place. Clarification What is rotated arr ...

  9. 设置windows网络连接别名和linux网络连接别名

    windows网络连接别名 C:\Windows\System32\drivers\etc目录下的hosts文件中添加 127.0.0.1 localhost 192.168.1.100 proxy. ...

  10. cocos2dx混合模式应用———制作新手引导高亮区域

    先看下效果 制造这个椭圆高亮区域所使用原图是 附上代码 bool HelloWorld::init() { ////////////////////////////// // 1. super ini ...