PAT1054. The Dominant Color (20)
#include <iostream>
#include <map>
using namespace std;
int n,m;
map<int,int> imgMap;
int maxV=0;
int v;
int main(){
cin>>n>>m;
for(int i=0;i<n;i++){
for(int j=0;j<m;j++){
int tmp;
cin>>tmp;
imgMap[tmp]++;
if(imgMap[tmp]>maxV){
maxV=imgMap[tmp];
v=tmp;
}
}
}
cout<<v<<endl;
return 0;
}
PAT1054. The Dominant Color (20)的更多相关文章
- PAT 甲级 1054 The Dominant Color (20 分)(简单题)
1054 The Dominant Color (20 分) Behind the scenes in the computer's memory, color is always talked ...
- 1054. The Dominant Color (20)
时间限制 100 ms 内存限制 65536 kB 代码长度限制 16000 B 判题程序 Standard 作者 CHEN, Yue Behind the scenes in the compute ...
- 1054 The Dominant Color (20)(20 分)
Behind the scenes in the computer's memory, color is always talked about as a series of 24 bits of i ...
- PAT (Advanced Level) Practice 1054 The Dominant Color (20 分)
Behind the scenes in the computer's memory, color is always talked about as a series of 24 bits of i ...
- 1054 The Dominant Color (20分)(水)
Behind the scenes in the computer's memory, color is always talked about as a series of 24 bits of i ...
- PAT甲题题解-1054. The Dominant Color (20)-排序/map
原本用map,发现超时了,后来便先用数组存储排个序,最后for一遍统计每种颜色出现的次数(每种颜色的首位索引相减+1),找出最多的即可. #include <iostream> #incl ...
- PAT (Advanced Level) 1054. The Dominant Color (20)
简单题 #include<cstdio> #include<cstring> #include<cmath> #include<vector> #inc ...
- 【PAT甲级】1054 The Dominant Color (20 分)
题意: 输入两个正整数M和N(M<=800,N<=600),分别代表一张图片的宽度和高度,接着输入N行每行包括M个点的颜色编号,输出这张图片主导色的编号.(一张图片的主导色占据了一半以上的 ...
- PAT 1054 The Dominant Color[简单][运行超时的问题]
1054 The Dominant Color (20)(20 分) Behind the scenes in the computer's memory, color is always talke ...
随机推荐
- hdu2732 (Leapin' Lizards)
题目链接:传送门 题目大意:给你 n,m n:有几行图,m是一个人最多跳m个曼哈顿距离. 给你两张图,第一张图数字为0表示没有柱子,否则有柱子且只能跳出去 x 次(x为当前字符代表的数字) 第二张图 ...
- db2 相关命令
db2ilist ---列出主机所有实例 db2icrt instanceName ---创建实例名为instanceName的实例 db2idrop instanceName ---删 ...
- servlet ; basepath ; sendredirected ;
Eclipse 新建 jsp页面里自动生成以下代码: <%String path = request.getContextPath();String basePath = request.get ...
- sql中in和exists的区别
in 和exists in是把外表和内表作hash 连接,而exists 是对外表作loop 循环,每次loop 循环再对内表进行查询. 一直以来认为exists 比in 效率高的说法是不准确的.如果 ...
- python 数据库查询条件`不等于`
1.python 数据库查询条件不等于 当在做数据库查询的时候,想根据业务需求进行条件的筛选或过滤, 但是django封装的数据库语句中没有 '不等于' 查询操作. 2.例如:通过以下语句进行'不等于 ...
- Android Paint setXfermode
背景: dst 前景: src PorterDuff.Mode.CLEAR 清除画布上图像 PorterDuff.Mode.XOR 取两层图像的非交集部门 PorterDuff.Mo ...
- 007-组件和Props
一.概述 组件让你可以将用户界面分成独立的,可重复使用的部分,并且可以独立思考每个部分. 从概念上讲,组件就像JavaScript函数一样.他们接受任意输入(称为“props”)并返回描述屏幕上应显示 ...
- HTTP状态码集
1xx消息 这一类型的状态码,代表请求已被接受,需要继续处理.这类响应是临时响应,只包含状态行和某些可选的响应头信息,并以空行结束.由于HTTP/1.0协议中没有定义任何1xx状态码,所以除非在某些试 ...
- ununtu16.04+python3+selenium+firefox环境搭建
一.初始配置: 1.安装完系统并配置好地址及DNS.2.设置root密码: sudo passwd root 3.更改云源: sudo cp /etc/apt/sources.list /etc/ap ...
- Eclipse+maven 导致Eclipse启动后Build workspaces卡死或者下载缓慢的问题
参考文档: (1)Eclipse 一直不停 building workspace完美解决总结 (2)eclipse 一直building workspace 问题 解决办法: (1)第一步: 修改ec ...