大致题意就是给出N行M列的元素,找出出现次数最多的元素并输出。

#include<iostream>
#include<unordered_map>
using namespace std; int main() {
unordered_map<int,int> mp;
int m,n;
cin>>m>>n;
for(int i = ; i < n; ++i) {
for(int j = ; j < m; ++j) {
int t;
scanf("%d",&t); //可能会超时,把cin改为scanf
mp[t]++;
}
}
int max = -,ans = ;
for(auto it = mp.begin(); it != mp.end(); ++it) {
if(max < it->second) {
max = it->second;
ans = it->first;
} }
cout<<ans;
return ;
}

1054 The Dominant Color的更多相关文章

  1. PAT 1054 The Dominant Color

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

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

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

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

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

  4. pat 1054 The Dominant Color(20 分)

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

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

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

  6. 1054. The Dominant Color (20)

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

  7. PAT 甲级 1054 The Dominant Color

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

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

  10. 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. opencv —— 官方 示例程序

    OpenCV 官方提供的示例程序,具体位于...\opencv\sources\samples\cpp 目录下. ...\opencv\sources\samples\cpp\tutorial_cod ...

  2. mac电脑怎么投屏?教你选择适合自己的Mac投屏软件

    mac上有什么好的投屏软件嘛?苹果手机ios投屏到mac用哪款投屏软件,mac投屏ipad该用哪款软件怎么操作,macdown小编给大家介绍的这几款Mac投屏软件,各有各的特色,总有一款适合你投屏. ...

  3. Linux CURL的安装和使用

    --获得安装包,从网上直接下载或者其他途径,这里直接wget# wget http://curl.haxx.se/download/curl-7.17.1.tar.gz--解压到当前目录# tar - ...

  4. 小白的java学习之路 “ 数组”

    数组 一.什么是数组: 数组是一个变量,存储相同数据类型的一组数据 声明一个变量就是在内存空间划出一块合适的空间 声明一个数组就是在内存空间划出一串连续的空间 二.数组基本要素: 标识符:数组的名称, ...

  5. iptables (一) 主机防火墙和网络防火墙

    Firewall : 防火墙,隔离工具:工作于主机或网络的边缘,对于进出本主机或网络的报文根据事先定义好的检测规则作匹配,对于能够被规则所匹配到的报文做出相应处理的组件:有主机防火墙和网络防火墙 Ip ...

  6. [P5665][CSP2019D2T2] 划分

    先说说部分分做法吧 1.\(n \leq 10\) 指数级瞎草都可以2333 2.\(n \leq 50\) 好像并没有什么做法-也许给剪枝的人部分分吧 3.\(n \leq 400\) 这个复杂度是 ...

  7. [SDOI2010]粟粟的书架 [主席树]

    [SDOI2010]粟粟的书架 考虑暴力怎么做 显然是提取出来 (x2-x1+1)*(y2-y1+1) 个数字拿出来 然后从大到小排序 然后就可以按次取数了- 然而接下来看数据范围 \(50\%\ r ...

  8. vue 问题总结

    1. 动态设置图片, <img :src="url"> data() { return { url: require(相对路径) // 直接写相对路径会出错 } } 2 ...

  9. 报表平台发行说明(V0.0.0.1)

    开发周期:共20天(2019-11-04~2019-11-23) 发布日期:2019-11-23 主要功能说明: 1  整体功能技术选型,前端(html+CSS+javascript)+Web API ...

  10. AI数学基础:符号

    1.sigma 表达式 ∑ 是一个求和符号,英语名称:Sigma,汉语名称:西格玛(大写Σ,小写σ) 第十八个希腊字母.在希腊语中,如果一个单字的最末一个字母是小写sigma,要把该字母写成 ς ,此 ...