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 ...
随机推荐
- JedisConnectionException: Unexpected end of stream.
在实际项目中遇到redis读取时报错. 报错是 [ERROR] redis.clients.jedis.exceptions.JedisConnectionException: Unexpected ...
- Handling Captcha | Webdriver
http://seleniumworks.blogspot.kr/2013/09/handling-captcha-webdriver.html Make use of the 'input' tag ...
- android studio导入包后无法import
android studio导入jar包的方法: 1.将jar包放到module的libs目录下 2.在所导入的jar包上右键,选择“Add as library”. 其中,第二点跟eclipse不同 ...
- mysql存入中文乱码问题
1. 查询编码 SHOW VARIABLES LIKE 'character_set_%' 2. 改数据库和单项 alter database tsdr character set utf8; set ...
- unity3d自带帮助文档的打开方法
1废话不提,直接上图: 2.在弹出来的浏览器窗口中点击: 3.在点击后的网页中即可以搜索了,在断网的情况下,作为资料查询还是蛮不错的.
- 使用Chrome DevTools的Timeline和Profiles提高Web应用程序的性能
来源: http://www.oschina.net/translate/performance-optimisation-with-timeline-profiles 我们都希望创建高性能的Web应 ...
- sql语句操作表
"create table mytable (m_id integer identity(1,1) primary key,m_class varchar(50) not null defa ...
- 【0-1 背包模板】 poj 3624
先看个未经优化的二维空间dp: #include <iostream> #include <cstdio> #include <cmath> #include &l ...
- apicloud教程2 (转载)
本帖最后由 中山赢友网络科技有限公司 于 2015-10-17 15:38 编辑 继<APICloud之小白图解教程系列(一):认识APICloud>之后的第二篇教程. 本篇教程有以下知识 ...
- oracle提高之索引学习
一. 索引介绍 1.1 索引的创建 语法 : CREATE UNIUQE | BITMAP INDEX <schema>.<index_name> ON <schema ...