1004 Let the Balloon Rise
来源:互联网 发布:mysql数据库的安装 编辑:程序博客网 时间:2024/05/29 03:35
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>int main(){ int n, i, j, k, max, p, b[1000], c[1000]; char a[1000][16]; while(scanf("%d", &n)!=EOF&&n) { k=0;p=0; getchar(); for(i=0;i<n;i++) { scanf("%s",a[i]); getchar(); } for(i=0;i<n;i++) { int count=1; for(j=i+1;j<n;j++) if(strcmp(a[i], a[j])==0) count++; b[k++]=count; c[p++]=i; } max=0; for(i=1;i<k;i++) if(b[i]>b[max]) max=i; printf("%s\n",a[max]); } return 0;}
阅读全文
0 0
- 1004 Let the Balloon Rise
- 1004 Let the Balloon Rise
- 1004 Let the Balloon Rise
- 1004let the balloon rise
- Let the Balloon Rise 1004
- 1004 Let the Balloon Rise
- Let the Balloon Rise(1004)
- 1004Let the Balloon Rise
- Let the Balloon Rise(1004)
- Let the Balloon Rise(1004)
- 1004:Let the Balloon Rise
- 1004 let the balloon rise
- 1004 Let the Balloon Rise
- 1004 Let the Balloon Rise
- 1004-Let the Balloon Rise
- 1004 Let the Balloon Rise
- 1004 Let the Balloon Rise
- 1004 Let the Balloon Rise
- S3C2440上LCD驱动(FrameBuffer)实例开发讲解
- FreeRTOS开发笔记
- 洛谷 P3939 数颜色
- itertools
- C# 常见的字节数组 byte[] 复制方法
- 1004 Let the Balloon Rise
- 登陆注册时的验证码实现
- Python_pandas_20171102
- java Timestamp、Date和String之间的互转
- Ubuntu16.04配置Darknet实现YOLO
- 【爬虫学习】MongoDB 学习心得
- html总结8大标签
- Mybatis与Spring集成源码研究之MapperScannerConfigurer
- IOS JS交互Webview重定向