1054. The Dominant Color (20)
来源:互联网 发布:windows 10不能打字 编辑:程序博客网 时间:2024/06/18 04:27
#include<cstdio>#include<string>#include<map>#include<iostream>using namespace std;int main(){ map<int,int> mp; int M,N; int color,MAX=0,k=0; scanf("%d%d",&M,&N); for(int i=0; i<N; i++) { for(int j=0; j<M; j++) { scanf("%d",&color); //直接加有危险!!! //mp[color]++; if(mp.find(color) != mp.end()) mp[color]++; else mp[color] = 1; } } for(map<int,int>::iterator it = mp.begin(); it!=mp.end(); it++) { if(it->second>MAX) { k = it->first; MAX = it->second; } } printf("%d",k); return 0;}
0 0
- 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)
- 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)
- 1054. The Dominant Color (20)
- 1054. The Dominant Color (20)
- 1054. The Dominant Color (20)
- 1054. The Dominant Color (20)
- Solr DocValues详解
- centos 杂记
- 反编译
- 分层和页面交互设计知识点
- Docker下kafka学习,三部曲之一:极速体验kafka
- 1054. The Dominant Color (20)
- 1075: 众数问题
- centos下 lnmp1.3安装 exif扩展
- php 条件语句if ,switch
- JSP文件中路径问题
- vlc_for_android(基于git-3.0.0)快速集成
- java学习【知识点及代码12.2】
- 1055. The World's Richest (25)
- c语言 ——回文