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 ...
随机推荐
- window 计算机 开启事务
window 操作系统如何开启事务 c#开发中使用事务调试程序的时候必须开启本地计算机的事务,如何开启呢: 1:控制面板 2:组件服务 3:本地DTC 4:设置 5:应用成功.
- App Store App申请审核加速
有没有遇到上线后发现很严重的bug这种情况,修复bug后提交审核又是漫长的等待,那样会把人逼疯的. 估计是为了对应这样的情况,Apple提供有一个加速审核的通道: https://developer. ...
- FineReport----查询功能 的知识点
1.设置日期控件,默认当前日期 2.默认不查询 选择参数:点击查询前不显示报表内容
- win7(iis7)无法加载运行CSS文件的解决方法
在打开或关闭window功能中的Internet信息服务里的万维网服务=>常见HTTP功能=>静态内容 ,将其选上 即可了,如下图
- mysql 中调用存储过程之后,连接断开不可用
解决方法: 由 mysql_real_connect(&m_mysql,host,user,passwd,Db,0,NULL,0) == NULL 改为 mysql_real_connect( ...
- Web 编程中编码问题
1. 常见字符编码 iso-8859-1(不支持中文) gbk(国标码) utf-8 (万国码, 支持全世界的编码) 2. 响应编码 当使用 response.getWriter() 来向客户端发送字 ...
- What is tail-recursion
Consider a simple function that adds the first N integers. (e.g. sum(5) = 1 + 2 + 3 + 4 + 5 = 15). H ...
- fopen() r+、w+属性详解
r+具有读写属性,从文件头开始写,保留原文件中没有被覆盖的内容: w+具有读写属性,写的时候如果文件存在,会被清空,从头开始写. r 打开只读文件,该文件必须存在. r+ 打开可读写的文件,该文件必须 ...
- 【Java编程】写入、读取、遍历Properties文件
在Java开发中通常我们会存储配置參数信息到属性文件.这种属性文件能够是拥有键值对的属性文件,也能够是XML文件.关于XML文件的操作,请參考博文[Java编程]DOM XML Parser 解析.遍 ...
- tarball源码安装
软件最原始的安装方法 用tarball来安装升级make命令执行make ,会在当前路径下搜索makefile这个文本文件,这个文件中记录了源码如何编译的详细信息.软件开发商通常会写一个检测程序,检测 ...