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 ...
随机推荐
- 拨打电话<a href="tel:">跳转到邮件<a href="mailto:">
拨打电话 <a href="tel:0571866000">0571-866000</a> 跳转到邮件 <a href="mailto:jo ...
- tableView的使用(一)
//tableView的创建 //1.初始化 initWithFrame:style:(plian,gronp) //2.设置属性(行高, 分割线, 表头, 表尾) //3.添加到父 ...
- Codeblocks自动代码格式化+快捷键
Codeblocks自动代码格式化+快捷键 - u010112268的博客 - CSDN博客 https://blog.csdn.net/u010112268/article/details/8110 ...
- FFMPEG推流到RTMP服务器命令 - weixin_37897683的博客 - CSDN博客 https://blog.csdn.net/weixin_37897683/article/details/81225228
FFMPEG推流到RTMP服务器命令 - weixin_37897683的博客 - CSDN博客 https://blog.csdn.net/weixin_37897683/article/detai ...
- 2015-03-22——js常用的Array方法
Array array.concat(item...); //产生一个新数组如果item,是一个数组,那么它的每个元素会被分别添加(浅复制,只解析一层).示例:var a = [1, 3, 4];v ...
- python可变参数*args, **kwargs
python可变参数*args, **kwargs def foo(* args, ** kwargs): print ' args = ', args print ' kwargs = ', k ...
- Django框架-模板系统
来看一段代码 def current_datetime(request): now = datetime.datetime.now() html = "<html><bod ...
- rest_framework 认证与权限
一 认证 1.1先写个类(认证组件) from app01 import models from rest_framework import exceptions from rest_framewo ...
- python多线程的两种写法
1.一般多线程 import threading def func(arg): # 获取当前执行该函数的线程的对象 t = threading.current_thread() # 根据当前线程对象获 ...
- 我的Android进阶之旅------>Android studio 如何修改工程的包名
关于用Android Studio修改Android APP的应用包名的问题,今天遇到了一个坑,这里记录一下. 这里用一个简单的Demo来展示在Android Studio中如何修改Android P ...