码迷,mamicode.com
首页 > 其他好文 > 详细

HDU 1029: Ignatius and the Princess IV

时间:2017-08-08 23:14:59      阅读:365      评论:0      收藏:0      [点我收藏+]

标签:std   namespace   ble   nat   problem   pre   ++   sbo   and   

Ignatius and the Princess IV

///@author Sycamore
///@date 8/8/2017
#include<bits/stdc++.h>
using namespace std;
int main()
{
	ios::sync_with_stdio(false);
	cin.tie(0);
	int n;
	while (cin >> n)
	{
		map<int, int>v;
		int t,ans=-1;
		for (int i = 1; i <=n; i++)
		{
			cin >> t;
			if(ans==-1)
			if (++v[t] >= ((n + 1) >> 1))
				ans = t;
		}
		cout << ans << endl;
	}
	return 0;
}

 

HDU 1029: Ignatius and the Princess IV

标签:std   namespace   ble   nat   problem   pre   ++   sbo   and   

原文地址:http://www.cnblogs.com/zjnu/p/7309130.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!