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. 这是一个无效的原路径/url

    当我们在SourceTree上新建一个“从URL克隆”的远程项目时,在确认“URL”无误的前提下依然报红色字体“这是一个无效的原路径/URL”错误,我们只需要快捷键“Command + ,”打开Sou ...

  2. iOS - CocoaPods操作详解

    在我们进行iOS应用开发的时候,肯定会用到很多的第三方类库,最常用AFNetworking,SDWebImage等等,当我们用到这个类库的时候,就要一个一个的去下载这个类库,如果这个类库中又用到了其他 ...

  3. (转)vuex2.0 基本使用(1) --- state

    Vuex 的核心是 store, 它是一个通过 Vuex.Store 构造函数生成的对象.为什么它会是核心呢?因为我们调用这个构造函数创建store 对象的时候,给它传递参数中包装了state, mu ...

  4. DeltaFish 校园物资共享平台 第一次小组会议

    软工小组第一次会议 会议地点:图书馆 会议时间:19:00 ~ 20:00 与会人员:软工小组全体成员 请假人员:无缺席人员:无 记录人:陈志锴 整理人:曾子轩 会议记录 一.确认选题 每一位成员提出 ...

  5. 【Linux】Ubuntu输入法不能开机自启的解决方法

    操作系统:Ubuntu Kylin 16.10 自从操作系统安装了搜狗输入法以后,每次重启电脑都需要手动启动Fcitx,才能启动搜狗输入法.下面给大家介绍输入法开机自启的解决方法: 操作系统的用户家目 ...

  6. JDK自带工具

    工具名称 描述 appletviewer.exe 用于运行并浏览applet小程序. apt.exe 注解处理工具(Annotation Processing Tool),主要用于注解处理. extc ...

  7. mongodb 下载与安装文档

    MongoDB数据库安装及配置环境(windows10系统)   windows10系统下MongoDB的安装及环境配置: MongoDB的安装 下载地址: https://www.mongodb.c ...

  8. ROS:Nvidia Jetson TK1开发平台

    原文链接: http://wiki.ros.org/NvidiaJetsonTK1 1. Nvidia Jetson TK1 Jetson TK1 comes pre-installed with L ...

  9. HDU_1847_基础博弈sg函数

    Good Luck in CET-4 Everybody! Time Limit: 1000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K ...

  10. html 底部虚线

    <div style="width: 100%; font-size: 14px; color: #666; border-bottom: 1px dashed #666;" ...