/*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. PHP下的Oauth2.0尝试 - OpenID Connect

    OpenID Connect OpenID Connect简介 OpenID Connect是基于OAuth 2.0规范族的可互操作的身份验证协议.它使用简单的REST / JSON消息流来实现,和之 ...

  2. 洛谷 2921 记忆化搜索 tarjan 基环外向树

    洛谷 2921 记忆化搜索 tarjan 传送门 (https://www.luogu.org/problem/show?pid=2921) 做这题的经历有点玄学,,起因是某个random题的同学突然 ...

  3. [环境搭建] VS-Visual Studio-IIS Express 支持局域网訪问

    原创作品,转载请注明出处:http://blog.csdn.net/qiujuer/article/details/40350385 使用Visual Studio开发Web网页的时候有这种情况:想要 ...

  4. Could not connect to SMTP host: localhost, port: 25;

    1.错误描写叙述 DEBUG: setDebug: JavaMail version 1.3.3 DEBUG: getProvider() returning javax.mail.Provider[ ...

  5. oracle 时间戳TIMESTAMP

    //数据库 UPDATETIMESTAMP TIMESTAMP(6) //dto /** 更新时间戳 **/ private String updatetimestamp; //dao //插入操作 ...

  6. C#帮助控件HelpProvider的使用

    using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; usin ...

  7. 数据结构—单链表(类C语言描写叙述)

    单链表 1.链接存储方法 链接方式存储的线性表简称为链表(Linked List). 链表的详细存储表示为: ① 用一组随意的存储单元来存放线性表的结点(这组存储单元既能够是连续的.也能够是不连续的) ...

  8. bzoj2756: [SCOI2012]奇怪的游戏(网络流+分情况)

    2756: [SCOI2012]奇怪的游戏 题目:传送门 题解: 发现做不出来的大难题一点一个网络流 %大佬 首先黑白染色(原来是套路...)染色之后就可以保证每次操作都一定会使黑白各一个各自的值加1 ...

  9. BZOJ 4289: PA2012 Tax(最短路)

    Time Limit: 10 Sec  Memory Limit: 128 MBSubmit: 755  Solved: 240[Submit][Status][Discuss] Descriptio ...

  10. 2019Pycharm激活方法

    1.将“0.0.0.0 account.jetbrains.com”添加到hosts文件中 2.打开http://idea.lanyus.com/ 3.获取激活码,粘贴到第二个选项中 亲测可用.