ZOJ 2104 Let the Balloon Rise

来源:互联网 发布:怪兽仙境3破解版java 编辑:程序博客网 时间:2024/05/17 07:10

继续水题。

#include <iostream>#include <cstdio>#include <map>#include <string>using namespace std;map<string, int> cnt;int n;char buf[100];int main(){    while(scanf("%d", &n) && n){        cnt.clear();        int maxv = 0;        string ans = "";        while(n-- ){            scanf("%s", buf);            cnt[buf]++;            if(cnt[buf] > maxv){                maxv = cnt[buf];                ans = buf;            }        }        printf("%s\n", ans.c_str());    }    return 0;}


原创粉丝点击