HDOJ 1004 Let the Balloon Rise
来源:互联网 发布:csol2控制台fps优化 编辑:程序博客网 时间:2024/05/28 14:57
Let the Balloon Rise
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
跟着大腿们学习!!!
#include<iostream>#include<string>using namespace std; int main(){int n;int i=0;string name[1001];int time[1001]={1};while(cin>>n&&n!=0){while(i<n){cin>>name[i];for(int j=0;j<i;j++){if(name[i]==name[j])time[i]++;}i++;}int temp=0;string temp1;for(int j=0;j<n;j++){if(temp<=time[j]){temp=time[j];temp1=name[j];}}cout<<temp1<<endl;i=0;}return 0;}
0 0
- HDOJ 1004 Let the Balloon Rise (map)
- HDOJ-1004 Let the Balloon Rise
- HDOJ 1004 Let the Balloon Rise
- HDOJ 1004 Let the Balloon Rise
- hdoj 1004 Let the Balloon Rise
- hdoj.1004 Let the Balloon Rise 20140726
- HDOJ Let the Balloon Rise 1004
- HDOJ 1004 Let the Balloon Rise
- HDOJ 1004 Let the Balloon Rise
- HDOJ 1004 Let the Balloon Rise(水题)
- 【HDOJ】【1004】Let the Balloon Rise
- HDOJ 1004 Let the Balloon Rise
- HDoj 1004 Let the Balloon Rise
- HDOJ 1004 Let the Balloon Rise
- HDOJ 1004 Let the Balloon Rise
- hdoj 1004 Let the Balloon Rise (map)
- HDOJ 1004 Let the Balloon Rise
- HDOJ 1004 Let the Balloon Rise
- 【网络爬虫】使用jsoup对dom树解析
- HDOJ 3507 Print Article (斜率优化DP)
- java缓存技术的介绍
- [数据结构]归并排序
- 献给青春的歌 · 致「 腾讯QQ 18 岁」
- HDOJ 1004 Let the Balloon Rise
- Matplotlib画图基础
- Codeforces803B Distances to Zero
- C语言中如何定义动态二维数组并输出
- 海量数据以及大数据常考的笔试面试题
- 卷积神经网络(CNN)资料收集
- Stm32-实时采集数据(温度与一氧化碳)并且通过wifi模块(Esp8266)实时传输到电脑
- windows环境下C++多线程文件传输
- BZOJ 1419: Red is good 期望DP