Let the Balloon Rise
来源:互联网 发布:淘宝客的pid哪里看 编辑:程序博客网 时间:2024/06/12 00:59
Let the Balloon Rise
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)
Total Submission(s): 79749 Accepted Submission(s): 29980
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 <stdio.h>#include <string.h>#include <stdlib.h>int a[1010];char s[1010][16];int main(){ int i,j,n,max; while(scanf("%d",&n) && n!=0) { for(i=0;i<n;i++) scanf("%s",s[i]); max=0; for(i=0;i<n;i++) { a[i]=1; for(j=i+1;j<n;j++) if(strcmp(s[i],s[j])==0) a[i]++; if(a[i]>max) max=a[i]; } for(i=0;i<n;i++) if(max==a[i]) puts(s[i]); } system("pause"); 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
- AUTH测试
- APK扩展文件及使用
- ActionServlet详解
- VC 和 Halcon 之间的互相赋值
- IOS的Crash
- Let the Balloon Rise
- Mysql中文乱码问题完美解决方案
- Android访问资源
- 使用GetAdaptersAddresses获取电脑所有MACAddress
- BZOJ 1486 HNOI2009 最小圈 二分答案+DFS
- ASP.NET 5系列教程 (三):view components介绍
- linux下动态库so文件的一些认识
- MFC实现2048游戏(一)
- 68MainActivity的消息回执