hdu_1004 Let the Balloon Rise

#include<bits/stdc++.h>
using namespace std;
int n,vmax;
string x,smax;
map<string,int> m;
map<string,int>::iterator p;

int main(){
    while(scanf("%d",&n) && n!=0){
        m.clear();
        vmax=0;
        while(n--){
            cin>>x;
            if(m.find(x)==m.end())m[x]=1;
            else m[x]++;
        }
        for(p=m.begin();p!=m.end();p++){
            if(p->second>vmax){
                vmax=p->second;
                smax=p->first;
            }
        }
        cout<<smax<<endl;
    }
    return 0;
}
时间: 2024-07-30 09:06:01

hdu_1004 Let the Balloon Rise的相关文章

hdu 1004 Let the Balloon Rise

Let the Balloon Rise Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 80469    Accepted Submission(s): 30293 Problem Description Contest time again! How excited it is to see balloons floating aro

HDU 1004 Let the Balloon Rise【STL&lt;map&gt;】

Let the Balloon Rise Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 123800    Accepted Submission(s): 48826 Problem Description Contest time again! How excited it is to see balloons floating ar

杭电1004 Let the Balloon Rise

Let the Balloon Rise Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 120507    Accepted Submission(s): 47270 Problem Description Contest time again! How excited it is to see balloons floating ar

HDU 1004 Let the Balloon Rise map

Let the Balloon Rise Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 104108    Accepted Submission(s): 40046 Problem Description Contest time again! How excited it is to see balloons floating ar

Let the Balloon Rise(map)

Let the Balloon Rise Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 91684    Accepted Submission(s): 34910 Problem Description Contest time again! How excited it is to see balloons floating aro

Let the Balloon Rise HDU 1004

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. B

HDUOJ Let the Balloon Rise 1004

 /* Let the Balloon Rise Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 89272    Accepted Submission(s): 33796 Problem Description Contest time again! How excited it is to see balloons float

HDU 1004 Let the Balloon Rise (map使用)

分析:题意简单,就用map的知识即可 #include <stdio.h> #include <iostream> #include <string.h> #include <map> using namespace std; int main() { int i,a,b,k; int N; char num[10]; while (~scanf("%d",&N)) { map<string,int> mp; whil

HDU-1004-Let the Balloon Rise(直接new一个字符串数组compareTo!)

Let the Balloon Rise Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 85666    Accepted Submission(s): 32330 Problem Description Contest time again! How excited it is to see balloons floating ar