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 M by 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
 #define _CRT_SECURE_NO_WARNINGS
#include <climits>
#include<iostream>
#include<vector>
#include<queue>
#include<map>
#include<set>
#include<stack>
#include<algorithm>
#include<string>
#include<cmath>
using namespace std; int main()
{
map<string, int> Map;
int N, M;
cin >> N >> M;
for (int i = ; i < M; i++)
{
for (int j = ; j < N; j++)
{
string s;
cin >> s;
Map[s]++;
}
}
int Max = ;
string s;
for(auto it:Map)
if (it.second > Max)
{
Max = it.second;
s = it.first;
}
cout << s;
}

1054 The Dominant Color (20分)(水)的更多相关文章

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

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

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

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

    题意: 输入两个正整数M和N(M<=800,N<=600),分别代表一张图片的宽度和高度,接着输入N行每行包括M个点的颜色编号,输出这张图片主导色的编号.(一张图片的主导色占据了一半以上的 ...

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

  5. 1054. The Dominant Color (20)

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

  6. PAT甲题题解-1054. The Dominant Color (20)-排序/map

    原本用map,发现超时了,后来便先用数组存储排个序,最后for一遍统计每种颜色出现的次数(每种颜色的首位索引相减+1),找出最多的即可. #include <iostream> #incl ...

  7. PAT (Advanced Level) 1054. The Dominant Color (20)

    简单题 #include<cstdio> #include<cstring> #include<cmath> #include<vector> #inc ...

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

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

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

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

随机推荐

  1. SpringBoot2 整合ElasticJob框架,定制化管理流程

    本文源码:GitHub·点这里 || GitEE·点这里 一.ElasticJob简介 1.定时任务 在前面的文章中,说过QuartJob这个定时任务,被广泛应用的定时任务标准.但Quartz核心点在 ...

  2. ZXingObjC直接引用第三方工程使用方法

    1.下载ZXingObjc压缩包,解压缩. 2.将文件拷贝到项目工程目录下 3.到工程目录中ZXingObjc文件夹中将ZXing的执行文件拖拽到项目中. 4.点击项目targets ——>Bu ...

  3. django 验证码图片生成视图函数

    def verify_code(request): import random # 定义验证码图片背景颜色 宽和高 bgcolor = (random.randrange(20,180),random ...

  4. scrapy pip中间件个人处理

    import pymongo from scrapy.conf import settings import pymysql class Mongodb_Pipeline(object): def _ ...

  5. 记一次华为eNSP设备网络项目基本配置过程

    下图为综合项目示例图,详细命令见图下: 屏蔽垃圾信息undo terminal monitorundo terminal trappingundo terminal loggingundo termi ...

  6. ECNU 计算机系统 (CSAPP) 教材习题作业答案集

    这里是华东师范大学计算机系统的作业答案.由于几乎每一年布置的习题都几乎相同,网上的答案又比较分散,就把自己上学期提交的作业pdf放上来了,供参考. 长这样 Download Link:http://c ...

  7. Python文本文件读写操作时的字符编码问题

    说明:文本文件的字符编码问题只存在t模式中,如:open('a.txt', mode='rt') 编码(encode): 我们输入的任何字符想要以文件(如.txt)的形式保存在计算机的硬盘上, 必须先 ...

  8. 6. concat_ws用法

    select  CONCAT_WS('-', e.audit_one_name, e.audit_second_name) from t_audit_item_name e  where e.id= ...

  9. MySQL:GROUP_CONCAT函数的使用

    原文链接 GROUP_CONCAT功能 将某个字段的值拼接成字符串. 举例使用 先看一下原始数据表 执行下面sql语句 SELECT `cid`,GROUP_CONCAT(mid) AS `mids` ...

  10. CERN Root与CLING

    CERN Root on Arch Linux For WSL: 一个CLI才是本体的程序居然有图形启动界面,莫名的微妙感 接触到Root是在一个4chan上喷matlab的thread里.某anon ...