Let the Balloon Rise
来源:互联网 发布:mac qq无法接收文件夹 编辑:程序博客网 时间:2024/04/27 15:37
Let the Balloon Rise
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 37885 Accepted Submission(s): 13036
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
这个题目不解释了,,基础
#include<iostream>#include<string>using namespace std;int main(){int n,i,j,sum=0,sun=0;string word[1001],a;while(cin>>n&&n!=0){for(i=0;i<n;i++)cin>>word[i];for(i=0;i<n;i++){for(j=0;j<n;j++)if(word[i]==word[j]){sun++;}if(sun>sum){sum=sun;a=word[i];}sun=0;}sum=0;cout<<a<<endl;}}
- 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
- 九种经典的Webshell提权技术
- 多项式相乘求组合数RC(n,r)
- 初次运行 Git 前的配置
- linux下C编程错误捕获函数
- JS获得当前时间 并格式化为:yyyy-MM-dd HH:MM:SS
- Let the Balloon Rise
- ldd3 scull错误移除
- linux time和timer
- jsp页面打印功能
- 黑马程序员--学习--高新技术--枚举和反射
- winform ui 设计
- jquery选择器
- 解决绝对定位层(position:absolute;)上无法触发滚动事件的问题
- Mutex Object的使用例子