博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
[解题报告]HDU 1004 Let the Balloon Rise
阅读量:5811 次
发布时间:2019-06-18

本文共 1665 字,大约阅读时间需要 5 分钟。

Let the Balloon Rise

Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)

Total Submission(s): 50554    Accepted Submission(s): 18117

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
 
 
 
 
 
 
 
 
 
用color[1000][16]来存储颜色信息
用num[1000]来统计每个颜色出现的次数
先输入一个颜色,从第二个颜色的输入开始,每输入一个,都要和之前输入的所有颜色进行比较,若是一样,则在数组对应位置上+1,
3
color[0] pink    
color[1] pink num[1]=2
color[2] blue num[2]=1
然后在num[1000]中查找最大数,输出其下标,找到对应的颜色输出
 
#include 
#include
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

 

转载于:https://www.cnblogs.com/TheLaughingMan/archive/2013/03/12/2956376.html

你可能感兴趣的文章
微软的云策略
查看>>
Valid Parentheses
查看>>
【ES6】数值的扩展
查看>>
性能测试之稳定性测试
查看>>
ES6的 Iterator 遍历器
查看>>
2019届高二(下)半期考试题(文科)
查看>>
nginx 301跳转到带www域名方法rewrite(转)
查看>>
AIX 配置vncserver
查看>>
windows下Python 3.x图形图像处理库PIL的安装
查看>>
【IL】IL生成exe的方法
查看>>
network
查看>>
SettingsNotePad++
查看>>
centos7安装cacti-1.0
查看>>
3个概念,入门 Vue 组件开发
查看>>
没有JS的前端:体积更小、速度更快!
查看>>
数据指标/表现度量系统(Performance Measurement System)综述
查看>>
GitHub宣布推出Electron 1.0和Devtron,并将提供无限制的私有代码库
查看>>
Angular2, NativeScript 和 React Native比较[翻译]
查看>>
论模式在领域驱动设计中的重要性
查看>>
国内首例:飞步无人卡车携手中国邮政、德邦投入日常运营
查看>>