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. py三个面试小问题

    1.是否遇到过Python的模块间循环引用的问题,如何避免它? 这是代码结构设计的问题,模块依赖和类依赖,如果老是觉得碰到循环引用可能的原因有几点: a.可能是模块的分界线划错地方了 b.可能是把应该 ...

  2. 减小ipa包大小

    1.删除不用的文件和图片 2.打release模式 3.色调单一图片采用8-bit的,对32-bit的图片采用压缩 4.对音视频采用aac压缩

  3. python框架之Django(14)-rest_framework模块

    APIView django原生View post请求 from django.shortcuts import render, HttpResponse from django import vie ...

  4. PHP中array_merge和array+array的区别

    在PHP中可以使用array_merge函数和两个数组相加array+array的方式进行数组合并,但两者效果并不相同,区别如下: 当下标为数值时,array_merge()不会覆盖掉原来的值,但ar ...

  5. 2018-2019-1 20189203《Linux内核原理与分析》第四周作业

    第一部分 课本学习 内核版本号:Linux内核自2013年12月起,就以A.B.C.D的方式命名.A和B变得无关紧要,C是内核的真实版本.每一个版本的变化都会带来新的特性,如内部API的变化等,改动的 ...

  6. C++中的对象初始化

    当对象在创建时获得了一个特定的值,我们说这个对象被初始化.初始化不是赋值,初始化的含义是创建变量赋予其一个初始值,而赋值的含义是把当前值擦除,而以一个新值来替代.对象初始化可以分为默认初始化.直接初始 ...

  7. 如何在java List中进行模糊查询

    比如我有下面这样一个List,里面存放的是多个Employee对象.然后我想对这个List进行按照Employee对象的名字进行模糊查询.有什么好的解决方案么? 比如我输入的查询条件为“wang”,那 ...

  8. 使用rander() 将后台的数据传递到前台界面显示出来

    1.创建templates文件夹 2.在该文件夹内创建html界面a.html 3.views.py: def a(request): love='iloveyou' return render(re ...

  9. word之选中文本

    在word和notepad中: 特别是在文件很大,如果用鼠标下滑的话,不知道会滑多久呢, 快捷键+鼠标点击截至处

  10. react和vue,angular的比较

    就这几天我所了解到react情况和大家探讨一下子react的知识: react由facebook团队维护的一套框架,已经应用在instagram网站上了,react以其独特的性能优化方案,正在被越来越 ...