Let the Balloon Rise
来源:互联网 发布:4年大数据 工资多少 编辑:程序博客网 时间:2024/05/21 17:21
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<span style="font-size:18px;">#include<iostream>#include<string> #include<cstring>using namespace std;string color[1050];int number[1050];int main(){int n;while(cin>>n){memset(number,0,sizeof(number));if(n==0)break;for(int i=0;i<n;i++){cin>>color[i];for(int j=0;j<i;j++){if(color[j]==color[i]){number[j]++;number[i]=0;}} } int x=0,y; for(int i=0;i<n;++i) { if(number[i]>x) { x=number[i]; y=i; } } cout<<color[y]<<endl;}return 0;} </span>
0 0
- Let the Balloon Rise
- Let the Balloon Rise
- Let the Balloon Rise
- Let the Balloon Rise
- Let the Balloon Rise
- Let the Balloon Rise
- Let the Balloon Rise
- Let the Balloon Rise
- Let the Balloon Rise
- Let the Balloon Rise
- Let the Balloon Rise
- Let the Balloon Rise
- Let the Balloon Rise
- Let the balloon rise
- Let the Balloon Rise
- Let the Balloon Rise
- Let the Balloon Rise
- Let the Balloon Rise
- Google Chrome 更新失败(错误:3)检查更新时出错
- 是个爷们,你就记住了
- UVa12583 - Memory Overflow
- 微信广告平台来了,是蜜糖还是毒药?
- 怎样成为说话高手
- Let the Balloon Rise
- 【Objective-C】08-OC对象的super关键字
- UVA - 10181 15-Puzzle Problem(15数码 A*)
- 下辈子,无论爱与不爱,都不会再见!
- Linux命令-----grep不查找隐藏文件夹的方法
- YV12、I420、YUV420P的区别
- 感悟
- android--系统jar包引用
- 采用PHP函数uniqid生成一个唯一的ID