图片标题

求是否有某个人分的钱比其他人加起来还要多,看是否有ID的次数超过n/2+1即可
#include <iostream>
#include <string.h>
#include <algorithm>
#include <stdio.h>
#include <math.h>
#include <map>
#include <string>
#include <set>
#include <stack>
#include<queue>
using namespace std;
#define forseach(i,j,n) for(int i=j;i<n;i++)
#define debug freopen("in.txt","r",stdin),freopen("out.txt","w",stdout);
#define ios ios::sync_with_stdio(0),cin.tie(0),cout.tie(0);
//#define PI acos(-1)
typedef long long ll;
const int maxn = 1e4+10;

map<int,int> mp;
int main()
{
	//debug;
	ios;
	int n,a;
	while(cin>>n)
	{
		for(int i=0;i<n;i++)
		{
			cin>>a;
			mp[a]++;
		}
		bool is_x=0;
		for(auto item:mp)
		{
			if(item.second>=(n/2+1))
			{
				cout<<item.first<<endl;
				is_x=1;
				break;
			}
		}
		if(!is_x)
			cout<<"-1"<<endl;
		mp.clear();
	}
    return 0;
}