PAT A1054 the dominent color (20)
来源:互联网 发布:basic和vb 编辑:程序博客网 时间:2024/05/22 15:33
#include<cstdio>
#include<algorithm>
#include<map>
using namespace std;
int main(){
int m,n;
map<int,int> mp;
scanf("%d%d",&m,&n);
int i,j;
int px,maxpx,maxnum=0;
for(i=0;i<n;i++){
for(j=0;j<m;j++){
scanf("%d",&px);
if(mp.count(px)==0) mp[px]=0;
mp[px]++;
if(mp[px]>maxnum){
maxnum=mp[px];
maxpx=px;
}
}
}
printf("%d\n",maxpx);
system("pause");
return 0;
}
#include<algorithm>
#include<map>
using namespace std;
int main(){
int m,n;
map<int,int> mp;
scanf("%d%d",&m,&n);
int i,j;
int px,maxpx,maxnum=0;
for(i=0;i<n;i++){
for(j=0;j<m;j++){
scanf("%d",&px);
if(mp.count(px)==0) mp[px]=0;
mp[px]++;
if(mp[px]>maxnum){
maxnum=mp[px];
maxpx=px;
}
}
}
printf("%d\n",maxpx);
system("pause");
return 0;
}
0 0
- PAT A1054 the dominent color (20)
- PAT-A1054. The Dominant Color (20)
- PAT A1054. The Dominant Color (20)
- pat-a1054. The Dominant Color (20)
- STL--PAT.A1054. The Dominant Color (20)【map】
- A1054.The Dominant Color
- PAT-A1054
- PAT-The Dominant Color (20)
- PAT a1054题解
- 1054. The Dominant Color (20)-PAT
- PAT 1054. The Dominant Color (20)
- PAT (Advanced) 1054. The Dominant Color (20)
- PAT: 1054. The Dominant Color (20)
- PAT A 1054. The Dominant Color (20)
- PAT 1054. The Dominant Color (20)
- PAT 1054. The Dominant Color (20)
- PAT 1054. The Dominant Color (20)
- pat 1054. The Dominant Color (20)
- SQL COOKLIST:写SQL中的习惯&语法&暗坑
- 1107. Social Clusters (30)[并查集]
- 欢迎使用CSDN-markdown编辑器
- 周笔记(8/52)
- 通过汇编一个简单的C程序,分析汇编代码,理解计算机如何工作
- PAT A1054 the dominent color (20)
- 卷积stack autoencoder(转载)
- NavigationView+ToolBar+TabLayout+ViewPager+Fragment综合使用
- CREELINKS平台_处理器CeCcp资源使用说明(CeCcp的配置与使用)
- PAT甲级1009. Product of Polynomials (25)
- Java集合HashMap源码
- Win10 Mobile For MI4体验
- SKlear中的LabelEncoding和OneHotEncoding
- git基本命令