您当前的位置: 首页 > 

暂无认证

  • 3浏览

    0关注

    100398博文

    0收益

  • 0浏览

    0点赞

    0打赏

    0留言

私信
关注
热门博文

Let the Balloon Rise HDU 1004

发布时间:2014-12-09 23:42:46 ,浏览量:3

Let the Balloon Rise Time Limit : 2000/1000ms (Java/Other)   Memory Limit : 65536/32768K (Java/Other) Total Submission(s) : 150   Accepted Submission(s) : 63
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.
 
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.
 
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
  
  
			
5 green red blue red red 3 pink orange pink 0
 
Sample Output
  
  
			
red pink
 
Author
WU, Jiazhi
 
#include#include#includeusing namespace std;
int main(){
    char str[1001][16];
    int count[1001];
    int n,i,j,index;
    int cnt;
    while(scanf("%d",&n),n){
        index=0;
        char temp[16];
        memset(count,0,sizeof(count));
        while(n--){
            scanf("%s",temp);
            for(j=0;jcount[cnt])
                cnt=i;
        printf("%s\n",str[cnt]);

    }
}
关注
打赏
1655516835
查看更多评论
立即登录/注册

微信扫码登录

0.0982s