Let the Balloon Rise
来源:互联网 发布:前台开发技术 知乎 编辑:程序博客网 时间:2024/06/05 22:45
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<string.h>#include<string>using namespace std; int main(){int n,i,j,max;char a[1000][20];while(cin>>n){int b[1001]={0};max=0;if(n==0)break;for(i=0;i<n;i++)cin>>a[i];for(i=0;i<n;i++){for(j=i+1;j<n;j++){if(strcmp(a[i],a[j])==0)b[i]++;}if(max<b[i])max=b[i];}for(i=0;i<n;i++){if(b[i]==max)cout<<a[i]<<endl;}}return 0;}
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
- linux 配置java
- ios自定义拍照界面和选取图片界面总结
- java 过滤器 监听器 详解
- Oracle SQL 内置函数大全
- android 遍历sd卡时出现activity无响应或空指针
- Let the Balloon Rise
- X的平方根
- shiro认证
- ios-sim
- Android 开发最佳实践
- Linux下配置安装PHP环境
- hql多表联合查询
- 判断点在三角形内
- VPN(PPTP)转发最终配置