hdu 1004

Let the Balloon Rise

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


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
#include <iostream>
#include <string>
using namespace std;
int main()
{
    int n,i,j,a[1000] = {0},maxi;
    string m[1000];
    while (cin>>n) 
    {
        if(n == 0)
            break;
        for (i = 0; i < 1000; i++) 
        {
            a[i] = 0;
        }
        
        for (i = 0; i < n; i++) 
        {
            cin>>m[i];
        }
        for (i = 0; i < n; i++) 
            for(j = 0; j< n; j++)
            {
                if (m[i] == m[j])
                    a[i]++;
            }
        maxi = a[0];
        j = 0;
        for (i = 0; i < n; i++) 
        {
            if (maxi < a[i]) 
            {
                maxi = a[i];
                j = i;
            }
        }
        cout<<m[j]<<endl;
    }
    return 0;
}


 

下载前必看:https://pan.quark.cn/s/a4b39357ea24 在当前快节奏的社会背景下,快递代拿服务已演变为日常生活中不可或缺的组成部分。 基于SSM(Spring、SpringMVC、MyBatis)框架的Java快递代拿系统,正是为了迎合这一需求而进行设计和构建的。 接下来将系统性地阐述系统的功能特性、架构布局以及具体的实现步骤。 1. **系统功能**: - **用户模块**:用户具备注册账户、登录验证、提交订单、挑选快递代取服务以及完成线上支付的各项操作。 - **订单模块**:当客户提交订单后,系统将自动生成包含快递种类、取件地点、送件地点等详细信息的订单记录,用户能够实时追踪订单进展,如待接单、处理中、已完成等不同阶段。 - **管理员模块**:管理员享有高级操作权限,能够接收并处理订单,执行订单的添加、删除、查询和修改等操作,同时负责处理用户的疑问和投诉。 - **支付模块**:系统整合了在线支付接口,支持用户通过第三方支付渠道完成支付,以此保障交易过程的安全性和便利性。 2. **技术选型**: - **SSM框架**:Spring主要用于依赖注入和事务控制,SpringMVC负责处理客户端请求与服务器响应,MyBatis作为数据持久化层,执行数据库交互,三者协同工作构建了一个高效且灵活的开发环境。 - **MySQL数据库**:系统内所有数据,包括用户资料、订单详情、支付历史等,均存储于MySQL数据库中,其卓越的查询性能和稳定性为系统提供了可靠的数据基础。 3. **系统架构**: - **前端**:运用HTML、CSS和JavaScript进行界面设计,可能还会引入Vue.js或jQuery等库以增强用户体验。 - **后端*...
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值