hdu 1004 Let the Balloon Rise
来源:互联网 发布:外加剂掺量怎么算法 编辑:程序博客网 时间:2024/06/14 16:10
Let the Balloon Rise
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)
Total Submission(s): 118806 Accepted Submission(s): 46576
Total Submission(s): 118806 Accepted Submission(s): 46576
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 <stdio.h>#include <algorithm>#include <map>#include <string.h>using namespace std;int main(){ int n; map<string,int>p; while(scanf("%d",&n),n) { string l,k[1010]; for(int i=0; i<n; i++) { cin>>l; p[l]++; k[i] = l; } for(int i=0; i<n; i++) { if(p[l] < p[k[i]]) l = k[i]; } cout<<l<<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
- 动态修改imageview大小
- java_学生管理系统_半成
- JAVA基础之注解
- codeforces 801 E. Vulnerable Kerbals(DAG最长路+解线性同于方程)
- 双线性插值
- hdu 1004 Let the Balloon Rise
- C#中virtual abstract和override的用法
- requestAnimationFrame
- Reverse Words in a String III
- ajax遍历json.put(String,String)
- 盈鹏飞嵌入式---OpenWRT在iMX6UL上面的移植与编译
- MarkDwon的使用以及基本语法
- iOS星级选择,可滑动的,可点击
- Oralce创建表用户和导入导出dmp文件