zoukankan      html  css  js  c++  java
  • HDU 1004:Let the Balloon Rise

    Let the Balloon Rise

    Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)
    Total Submission(s): 98230    Accepted Submission(s): 37599


    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
     

    Author
    WU, Jiazhi
     

    Source
     

    Recommend
    JGShining   |   We have carefully selected several similar problems for you:  1003 1019 1013 1012 1020 
     

    你  离  开  了  ,  我  的  世  界  里  只  剩  下  雨  。  。  。

    #include<stdio.h>
    #include<string.h>
    #include<iostream>
    using namespace std;
    int main()
    {
        int i,a,max[1005],ma=0,jj=0;
        string s[1005];
        while(cin>>a&&a)
        {
            ma=0,jj=0;
            memset(max,0,sizeof(max));
            for(i=0; i<a; i++)
            {
                cin>>s[i];
                for(int k=0; k<i; k++)
                    if(s[k]==s[i])max[i]++;
            }
            for(i=0; i<a; i++)
                if(ma<max[i])
                    ma=max[i],jj=i;
            cout<<s[jj]<<endl;
        }
        return 0;
    }
    

  • 相关阅读:
    OSPF 相关知识点
    基于LINUX 主机防火墙的端口转发
    WSUS服务器硬盘空间不足,如何迁移补丁文件夹
    ESXi 5.5开启并配置SNMP
    识别远程操作系统
    一个真实的社会
    "要敢杀掉旧的自己,新的自己才会诞生”读后感
    关于独立
    创业心得:从客户的抱怨中发现市场机会
    学习和思考的要点
  • 原文地址:https://www.cnblogs.com/im0qianqian/p/5989601.html
Copyright © 2011-2022 走看看