少年Q


私信TA

用户名:yin19990129

访问量:22603

签 名:

这次一定不水了!

等  级
排  名 193
经  验 6466
参赛次数 2
文章发表 71
年  龄 21
在职情况 学生
学  校 宿迁学院
专  业 软件工程

  自我简介:

 

0.0分

2 人评分

看不懂代码?想转换其他语言的代码? 或者想问其他问题? 试试问问AI编程助手,随时响应你的问题:

编程语言转换

万能编程问答

代码解释器

  评论区

#include<iostream>
#include<map>
#include<functional>
using namespace std;
int main(void)
{
	int i;
	long long int n,temp,len;
	while(cin>>n)
	{
		len=n;
		map<int,int,greater<int> >num;
		map<int,int,greater<int> >::iterator p;
		while(n--)
		{
			cin>>temp;
			num[temp]++;
		}
		p=num.begin();
		if(p->second>(len+1)/2)
		cout<<p->first<<endl;
	}
	return 0;
}
我和楼主写的几乎一样,为什么我AC不了啊(ཀ ⌂ ཀ)
2022-08-24 01:48:37
  • «
  • 1
  • »