PAT (Advanced Level) 1054. The Dominant Color (20)
简单题
#include<cstdio>
#include<cstring>
#include<cmath>
#include<vector>
#include<queue>
#include<algorithm>
using namespace std; int a[];
int n,m; int main()
{
scanf("%d%d",&n,&m);
for(int i=;i<n*m;i++) scanf("%d",&a[i]);
sort(a,a+n*m); a[n*m]=; int num=;
for(int i=;i<=n*m;i++)
{
if(a[i]==a[i-]) num++;
else
{
if(num>n*m/)
{
printf("%d\n",a[i-]);
break;
}
else num=;
}
}
return ;
}
PAT (Advanced Level) 1054. The Dominant Color (20)的更多相关文章
- 【PAT甲级】1054 The Dominant Color (20 分)
题意: 输入两个正整数M和N(M<=800,N<=600),分别代表一张图片的宽度和高度,接着输入N行每行包括M个点的颜色编号,输出这张图片主导色的编号.(一张图片的主导色占据了一半以上的 ...
- PAT 甲级 1054 The Dominant Color (20 分)(简单题)
1054 The Dominant Color (20 分) Behind the scenes in the computer's memory, color is always talked ...
- PAT (Advanced Level) Practice 1046 Shortest Distance (20 分) 凌宸1642
PAT (Advanced Level) Practice 1046 Shortest Distance (20 分) 凌宸1642 题目描述: The task is really simple: ...
- PAT (Advanced Level) Practice 1042 Shuffling Machine (20 分) 凌宸1642
PAT (Advanced Level) Practice 1042 Shuffling Machine (20 分) 凌宸1642 题目描述: Shuffling is a procedure us ...
- PAT (Advanced Level) Practice 1041 Be Unique (20 分) 凌宸1642
PAT (Advanced Level) Practice 1041 Be Unique (20 分) 凌宸1642 题目描述: Being unique is so important to peo ...
- PAT (Advanced Level) Practice 1015 Reversible Primes (20 分) 凌宸1642
PAT (Advanced Level) Practice 1015 Reversible Primes (20 分) 凌宸1642 题目描述: A reversible prime in any n ...
- 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)
时间限制 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 ...
随机推荐
- 第十六节,基本数据类型,字典dict
字典 常用操作: 索引 新增 删除 键.值.键值对 循环 长度 字典由键值对组成,由一个键(名称)和 一个值组成,与列表和元组不同的是里面的元素是有键的(名称) 所以当要打印字典时,打印字典变量加[键 ...
- HDU2502:月之数
Problem Description 当寒月还在读大一的时候,他在一本武林秘籍中(据后来考证,估计是计算机基础,狂汗-ing),发现了神奇的二进制数. 如果一个正整数m表示成二进制,它的位数为n(不 ...
- iOS中date和string的相互转换
必须知道的内容 G: 公元时代,例如AD公元 yy: 年的后2位 yyyy: 完整年 MM: 月,显示为1-12 MMM: 月,显示为英文月份简写,如 Jan ...
- jax-rs的客户端完整实例
本地接口: @Override public Response formsubGet(String accountContent, char inputContent, S ...
- .Net下HTTP访问穿越多层代理的方法以及代理服务器的验证 转载
https://blog.williamgates.net/2006/07/aspdotnet-through-multi-proxy/ 首先,通过普通的匿名透明代理的方法,是直接使用Socket发送 ...
- docker镜像与容器概念
本文用图文并茂的方式介绍了容器.镜像的区别和Docker每个命令后面的技术细节,能够很好的帮助读者深入理解Docker. 这篇文章希望能够帮助读者深入理解Docker的命令,还有容器(containe ...
- FreeRTOS中断优先级配置(重要)
FreeRTOS中断优先级配置(重要) 本章节为大家讲解FreeRTOS中断优先级配置,此章节非常重要,初学者经常在这里犯迷糊.对于初学者来说,本章节务必要整明白.12.1 NVIC基础知识12.2 ...
- 【java】基础中的杂乱总结(一)
1 构造代码块 作用:给对象进行初始化.对象一建立就运行,并且优先于构造函数执行 构造函数是给所有对象进行统一初始化,构造函数是给对应的对象初始化 package package1; class Pe ...
- FileSystemXmlApplicationContext方法的绝对路径问题
public AgentServer(Socket c,String confDir) { this.client = c; ApplicationContext ac = new FileSyste ...
- Coupons and Discounts
Coupons and Discounts time limit per test 1 second memory limit per test 256 megabytes input standar ...