Let the Balloon Rise

Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)

Total Submission(s): 93272    Accepted Submission(s): 35595

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

#include<stdio.h>
#include<string.h>
char str[1001][100],a[100];
int b[1000];
int main()
{
int n;
while(scanf("%d",&n),n)
{
int cnt=0,flog,max=0,op;
for(int i=0;i<n;i++)
{
memset(a,'\0',sizeof(a));
flog=0;
scanf("%s",a);
if(i==0)
{
strcpy(str[cnt++],a);continue;
}
else
{
for(int j=0;j<cnt;j++)
if(strcmp(str[j],a)==0)
{
flog=1;b[j]++;
if(b[j]>max)
{
max=b[j];
op=j;
}
}
if(!flog)
strcpy(str[cnt++],a);
}
}
printf("%s\n",str[op]);
}
return 0;
}

hdoj-1004-Let the Balloon Rise(水题)的更多相关文章

  1. HDOJ 1004 Let the Balloon Rise

    Problem Description Contest time again! How excited it is to see balloons floating around. But to te ...

  2. HDOJ 1004 Let the Balloon Rise (字符串+stl)

    题目: Problem Description Contest time again! How excited it is to see balloons floating around. But t ...

  3. hdu 1004 Let the Balloon Rise(字典树)

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

  4. HDU 1004 Let the Balloon Rise(map的使用)

    传送门: http://acm.hdu.edu.cn/showproblem.php?pid=1004 Let the Balloon Rise Time Limit: 2000/1000 MS (J ...

  5. 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 ...

  6. 杭电1004 Let the Balloon Rise

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

  7. hdu 1004 Let the Balloon Rise

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

  8. 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 ...

  9. HDOJ/HDU 1328 IBM Minus One(水题一个,试试手)

    Problem Description You may have heard of the book '2001 - A Space Odyssey' by Arthur C. Clarke, or ...

  10. HDOJ(HDU) 2090 算菜价(简单水题、)

    Problem Description 妈妈每天都要出去买菜,但是回来后,兜里的钱也懒得数一数,到底花了多少钱真是一笔糊涂帐.现在好了,作为好儿子(女儿)的你可以给她用程序算一下了,呵呵. Input ...

随机推荐

  1. (转) OpenLayers3基础教程——加载资源

    概述: 本节讲述如何在Ol3中加载wms图层并显示到地图中. Ol3下载: 你可以在OL官网去下载,下载地址为http://openlayers.org/download/,也可以去我的百度云盘下载, ...

  2. dispatch_sync

    dispatch_sync does two things: queue a block blocks the current thread until the block has finished ...

  3. python 从给定的URL中提取顶级域名(TLD)

    安装 PyPI的最新稳定版本: pip install tld 或者GitHub的最新稳定版本: pip install https://github.com/barseghyanartur/tld/ ...

  4. eas之载入编辑界面时设置明细默认值createNewDate()

    protected com.kingdee.bos.dao.IObjectValue.createNewDate(){    //new一个对象    PurOrderInfo info=new Pu ...

  5. HTTP 下载文件中文文件名在 Firefox 下乱码问题

    转自:http://www.imhdr.com/991/ HTTP 下载文件,中文文件名在 Firefox 下乱码问题 最近帮助一同事解决 HTTP 下载文件时,中文文件名在 Firefox 下乱码的 ...

  6. [luogu2825 HEOI2016/TJOI2016] 游戏 (二分图最大匹配)

    传送门 Description 在2016年,佳缘姐姐喜欢上了一款游戏,叫做泡泡堂.简单的说,这个游戏就是在一张地图上放上若干个炸弹,看是否能炸到对手,或者躲开对手的炸弹.在玩游戏的过程中,小H想到了 ...

  7. 记一次惊心的网站 TCP 队列问题排查经历

    https://blog.csdn.net/chenlycly/article/details/80868990 http://www.mytju.com/classcode/news_readnew ...

  8. Oracle数据库的性能调整

    oracle是一个高性能数据库软件.用户可以通过参数的调整,达到性能的优化.性能优化主要分为两部分:一是数据库管理员通过对系统参数的调整达到优化的目的,二是开发人员通过对应用程序的优化达到调整的目的. ...

  9. cxdbtreelist的处理点滴

    aaarticlea/png;base64,iVBORw0KGgoAAAANSUhEUgAAAuAAAAE8CAIAAAAOqJOXAAAgAElEQVR4nOy9eXAcV37n+bwzf21sbO ...

  10. 格式化LInux后开机进入grub怎么办

    问题:格式化Linux系统盘之后,重启进入grub 1.grub 引导进入windows系统 进入grub grub>rootnoverify (hd0,1) [可以使用Tab键( 比如 roo ...