hdu 1029 Ignatius and the Princess IV 每日水题

#include<stdio.h>
#include<string.h>
#include<map>
#include<iostream>
using namespace std;
int main()
{
int n,k;
map<int,int>m;
while(scanf("%d",&n)!=EOF)
{
m.clear();
for(int i=0;i<n;i++)
{
scanf("%d",&k);
m[k]++;
}
map<int,int>::iterator it;
for(it=m.begin();it!=m.end();it++)
if(it->second>=(n+1)/2)printf("%d\n",it->first);
}
}

原文地址:https://www.cnblogs.com/XDJjy/p/2999236.html