/*Let the Balloon Rise

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>
#include<stdlib.h>
# define N 1005
char str[N][15];
int main()
{
int i,j,count[1000],t,n,k;
while(scanf("%d",&n),n!=0)
{
t=0;记着要清零。
for(i=0;i<n;i++)
scanf("%s",str[i]);
memset(count,0,sizeof(int)*1000);//把count都初始为0
for(i=0;i<n;i++)
{
for(j=i+1;j<=n;j++)
{
if(strcmp(str[i],str[j])==0)
{
count[t]++;
}
}
t++;
}
k=0;
for(i=0;i<t;i++)
{
if(count[i]>=count[k])
k=i;
}
printf("%s\n",str[k]);
}
return 0;
}

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

随机推荐

  1. webpack基础知识点

    webpack 是一个现代的 JavaScript 应用程序的模块打包器(module bundler). 入口(Entry) webpack 将创建所有应用程序的依赖关系图表(dependency ...

  2. 【 【henuacm2016级暑期训练】动态规划专题 P】Animals

    [链接] 我是链接,点我呀:) [题意] 在这里输入题意 [题解] 第i只动物如果饲养它的话. 代价是固定的就是(n-i+1)a[i] 所以相当于给你n个物品,每个物品的重量为(n-i+1)a[i], ...

  3. java JSON 和 Object 相互转换

    1.导入 jackson jar <dependency> <groupId>com.fasterxml.jackson.core</groupId> <ar ...

  4. Springboot 应用启动分析

    https://blog.csdn.net/hengyunabc/article/details/50120001#comments 一,spring boot quick start 在spring ...

  5. .NET开源项目一览

  6. Java 获取环境变量

    Java 获取环境变量Java 获取环境变量的方式很简单: System.getEnv()  得到所有的环境变量System.getEnv(key) 得到某个环境变量的值 由于某些需要,可能要下载某些 ...

  7. JAVA学习之 异常处理机制

    今天就来说说java的异常处理机制,异常处理不是第一接触,尤其是写过非常多c#的代码,基本都会写到异常处理的代码,事实上c#的异常处理与java的异常处理基本都是一样的,仅仅是在一些细节上不是非常一样 ...

  8. servlet修改后无效,仍然还是修改之前的效果

    注意servlet的路径是否正确,默认是java resources文件夹中的src.当在webcontent->web-inf->classses->data中时,注意添加路径.否 ...

  9. Binary operations #1

    https://www.codewars.com/kata/binary-operations-number-1/train/csharp Your work is to write a method ...

  10. VMware虚拟机ubuntu显示屏幕太小解决办法

    使用VMware安装的ubuntu虚拟机的显示屏幕太小,可以通过在VMware里安装"VMware Tool"插件解决,安装步骤记录一下. 1. 更改ISO文件路径 安装VMwar ...