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 ...
随机推荐
- YII2 请求(request)
请求 一个应用的请求是用 yii\web\Request 对象来表示的,该对象提供了诸如 请求参数(译者注:通常是GET参数或者POST参数).HTTP头.cookies等信息. 默认情况下,对于一个 ...
- Linux系统手动安装rpm包依赖关系分析(以Kernel升级为例)
有在Linux系统中安装软件的经历的人都知道,在Linux系统中手动安装软件不想在Windows下安装软件那么方便,直接双击,然后下一步下一步就可以把软件成功的装入到系统中,而在Linux系统中,安装 ...
- word、pdf、ppt 转为图片
office word文档.pdf文档.powerpoint幻灯片是非常常用的文档类型,在现实中经常有需求需要将它们转换成图片 -- 即将word.pdf.ppt文档的每一页转换成一张对应的图片,就像 ...
- PAXOS may not terminate
It’s easy to see that Paxos does have a failure mode. When two proposers are active at the same time ...
- 解决Xcode 9.2系统真机测试时出现 could not find developer disk image问题
解决Xcode在ipad/iphone 9.2 系统真机测试时出现could not find developer disk image问题 第一种方法:拷贝这个文件(http://download. ...
- shell之路【第二篇】运算与文件调用
Bash 支持很多运算符,包括算数运算符.关系运算符.布尔运算符.字符串运算符和文件测试运算符. 原生bash不支持简单的数学运算,默认都是字符串操作,但是可以通过其他命令来实现 算数运算 expr. ...
- Hadoop2.6.0 动态增加节点
本文主要从基础准备,添加DataNode和添加NodeManager三个部分详细说明在Hadoop2.6.0环境下,如何动态新增节点到集群中. 基础准备 在基础准备部分,主要是设置hadoop运行的系 ...
- .net简单的静态页生成
1.得到实体对象model,读取模板 string htmlMaster = File.ReadAllText(HttpContext.Current.Server.MapPath("/ma ...
- MySql 加锁问题
1.设置非自动提交 set autocommit=0; 这时候 for update才会起作用 2.一般用法 set autocommit=0; for update(加锁) ; commit ...
- Application的多种值判断测试程序
Application.Contents.Remove("FriendLink") Response.Write("Application.Contents.Remove ...