hdu 1004 Let the Balloon Rise
来源:互联网 发布:传销金字塔算法 编辑:程序博客网 时间:2024/05/22 17:07
Let the Balloon Rise
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 128387 Accepted Submission(s): 50713
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.
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.
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
5greenredblueredred3pinkorangepink0
Sample Output
redpink
Author
WU, Jiazhi
Source
ZJCPC2004
Recommend
JGShining | We have carefully selected several similar problems for you: 1008 1005 1009 1019 1021
代码:
#include<iostream>#include<cstring>#include<algorithm>using namespace std;struct node{ char a[16]; int d;}s[1010];int cmp(node a,node b){ return a.d>b.d;}int main(){ int n; while(cin>>n&&n) { for(int i=0;i<n;i++) { s[i].d=0; cin>>s[i].a; for(int j=0;j<i;j++) { if(strcmp(s[i].a,s[j].a)==0) s[i].d++; } } sort(s,s+n,cmp); cout<<s[0].a<<endl; } return 0;}
阅读全文
0 0
- HDU 1004 Let the Balloon Rise
- HDU 1004 Let the Balloon Rise
- hdu 1004 Let the Balloon Rise
- HDU 1004 Let the Balloon Rise
- HDU--1004 Let the Balloon Rise
- hdu 1004 Let the Balloon Rise
- hdu 1004 Let the Balloon Rise
- HDU 1004 Let the Balloon Rise
- hdu 1004 Let the Balloon Rise
- HDU 1004 Let the Balloon Rise
- HDU 1004 Let the Balloon Rise
- Hdu 1004 - Let the Balloon Rise
- HDU 1004 Let the Balloon Rise
- HDU 1004 Let the Balloon Rise
- HDU--1004--Let the Balloon Rise
- hdu 1004 Let the Balloon Rise
- hdu 1004 Let the Balloon Rise
- HDU 1004 Let the Balloon Rise STL
- Java8接口的默认方法
- HDU1052 Tian Ji -- The Horse Racing(贪心)
- MD5加密算法源码
- 周志华机器学习 西瓜书(PDF) 斯坦福大学机器学习视频 机器学习基石+技法 邹博机器学习 七月在线机器学习 资源下载
- Python cv2灰度图转伪彩图
- hdu 1004 Let the Balloon Rise
- 关于ggplot2的一些用法
- B
- HTML基础篇
- Ubuntu16.04+CUDA+CUDNN+Anaconda+Tensorflow+keras深度学习环境搭建
- 不可按按钮
- thinking in java读书笔记
- 做好一个程序员
- C