1054. The Dominant Color
来源:互联网 发布:凯哥学堂java基础 编辑:程序博客网 时间:2024/05/16 18:43
#include<cstdio>
#include<iostream>
#include<cstdio>
#include<unordered_map>
#include<algorithm>
using namespace std;
int main()
{
unordered_map<int,int>cnt;
int n,m;
cin>>n>>m;
for(int i=0;i<m;++i)
for(int t,j=0;j<n;++j)
{
scanf("%d",&t);
++cnt[t];
}
cout<<find_if(cnt.begin(),cnt.end(),[&](pair<const int,int>&x){return x.second>(n*m)/2;})->first;
return 0;
}
#include<iostream>
#include<cstdio>
#include<unordered_map>
#include<algorithm>
using namespace std;
int main()
{
unordered_map<int,int>cnt;
int n,m;
cin>>n>>m;
for(int i=0;i<m;++i)
for(int t,j=0;j<n;++j)
{
scanf("%d",&t);
++cnt[t];
}
cout<<find_if(cnt.begin(),cnt.end(),[&](pair<const int,int>&x){return x.second>(n*m)/2;})->first;
return 0;
}
0 0
- 1054. The Dominant Color
- 1054.The Dominant Color
- 1054. The Dominant Color
- 1054. The Dominant Color
- 1054. The Dominant Color
- 1054. The Dominant Color
- 1054. The Dominant Color (20)
- 1054. The Dominant Color (20)
- 1054. The Dominant Color (20)
- PAT 1054. The Dominant Color
- PAT 1054. The Dominant Color
- 1054. The Dominant Color (20)
- 1054. The Dominant Color (20)
- 1054. The Dominant Color (20)
- 1054. The Dominant Color (20)
- 1054. The Dominant Color (20)
- 1054. The Dominant Color (20)
- 1054. The Dominant Color (20)
- 网络工程师和linux运维、学哪个好呢?
- 螺旋矩阵
- java中常用的工具类——File工具类
- 网络工程师能赚多少钱???
- hdu 2138——How many prime numbers
- 1054. The Dominant Color
- qt编译过程中出现错误:arm-linux-g++ could not found
- 要离职,公司竟招些坑爹的网管,主管那边过不去。网管--一个烂大 ...
- Hessian实现Webservice
- 书籍推荐14年七月-商业 交互 设计 开发
- 从网络中下载文件,并且写入SDCARD根目录下,成功返回true,失败返回false
- 我的面试和选择经历
- leetcode-Reverse Words in a String
- C-字符串完美处理的程序——好好汲取