Let the Balloon Rise

Time Limit:1000MS  Memory Limit:65536K

Total Submit:92 Accepted:58

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>
int main()
{
int n,i,j,num[1000];
int max=0,t=0;
char color[1000][16];
while(scanf("%d",&n)!=EOF)
{
if(n)
{
num[0]=0;
scanf("%s",color[0]);
for(i=1;i<n;i++)
{
num[i]=0;
scanf("%s",color[i]);
for(j=0;j<i-1;j++)
if(strcmp(color[i],color[j])==0) num[i]+=1;
}
max=0;
t=0;
for(i=1;i<n;i++)
if(max<num[i])
{
max=num[i];
t=i;}
printf("%s\n",color[t]);
}
else break;
}
}

akoj-1073- 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. 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 ...

  8. Let the Balloon Rise(水)

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

  9. 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. Hibernate基础知识总结

    Hibernate是JDBC的轻量级的对象封装(encapsulation),它是一个独立的对象持久persistence层框架. hibernate要做的事,就是让对象投影到关系数据库中,然后实施化 ...

  2. SQL数据库操作(CURD)

    对数据仓库的操作(CURD): 新增:  create database db_test; 新增的时候设置编码: create database da_test_1 character set utf ...

  3. 【hibernate初探】之接口说明,session使用

    hibernate作为一个完整的ORM映射框架,通过配置即可以让我们从复杂的JDBC操作中脱离出来.hibernate封装了 JDBC,JTA(java transaction API) 和JNDI. ...

  4. Chrome浏览器扩展开发系列之一:初识Google Chrome扩展

    1.       Google Chrome扩展简介 Google Chrome扩展是一种软件,以增强Chrome浏览器的功能. Google Chrome扩展使用HTML.JavaScript.CS ...

  5. [CF787D]遗产(Legacy)-线段树-优化Dijkstra(内含数据生成器)

    Problem 遗产 题目大意 给出一个带权有向图,有三种操作: 1.u->v添加一条权值为w的边 2.区间[l,r]->v添加权值为w的边 3.v->区间[l,r]添加权值为w的边 ...

  6. python新手之2变量

    变量 变量是将储存的值保存在内存中.当声明一个变量的时候会在内存中开辟一个储存内容的位置. 基于变量的数据类型,解释器分配内存空间并决定储存的内容.因此我们可以通过变量分配不同的数据类型,可以在变量中 ...

  7. springmvc+jdbc连接数据库(第一个微商项目,代理注册)

    String uuid = UUID.randomUUID().toString().trim().replaceAll("-", "");手动自动生成Uuid ...

  8. ps_cc切片

    web前端开发的工作流程的第一步就是根据ui给的psd来还原设计图样貌. 可是一打开满屏的参考线.这时我们可以alt+v+d清空参考线 这时可以按alt+鼠标拖放图片.同时也可以按F进入半屏和匀速连按 ...

  9. 理解梯度下降法(Gradient Decent)

    1. 什么是梯度下降法?   梯度下降法(Gradient Decent)是一种常用的最优化方法,是求解无约束问题最古老也是最常用的方法之一.也被称之为最速下降法.梯度下降法在机器学习中十分常见,多用 ...

  10. Angularjs Material

    公司用Angularjs Material进行开发,之前在网站上看了一些Demo,做一个学习的整理. 1.新建窗体的数据绑定 1.1修改kendo表格新增页面按钮,添加按钮,并Dialog一个窗体 t ...