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 ...
随机推荐
- Handling Captcha | Webdriver
http://seleniumworks.blogspot.kr/2013/09/handling-captcha-webdriver.html Make use of the 'input' tag ...
- hdu_5795_A Simple Nim(打表找规律的博弈)
题目链接:hdu_5795_A Simple Nim 题意: 有N堆石子,你可以取每堆的1-m个,也可以将这堆石子分成3堆,问你先手输还是赢 题解: 打表找规律可得: sg[0]=0 当x=8k+7时 ...
- hdu_3562_B-number(记忆化搜索|数位DP)
题目连接:http://acm.hdu.edu.cn/showproblem.php?pid=3652 题意:给你一个n,为比n小的能整除13并数字中有13的数有多少个 题解:记忆化搜索:记dp[i] ...
- mvc UrlHelper
何谓Helper,其实就是在View中为了实现一些灵活功能而写的方法组. 其实ASP.NET MVC的View是Aspx的页面,本身可以声明定义方法,那为什么要有Helper呢? 其实无非是将界面与逻 ...
- sublime Text 常用操作
原文出处:http://www.php100.com/html/it/focus/2014/1030/7666.html 1. 多光标操作:只要按下Cmd(Windows系统下Ctrl)键,再用鼠标选 ...
- web前端与后端
Web前端: 1)精通HTML,能够书写语义合理,结构清晰,易维护的HTML结构. 2)精通CSS,能够还原视觉设计,并兼容业界承认的主流浏览器. 3)熟悉JavaScript ...
- 解决win7和ubuntu双系统ubuntu不能上网的问题
1.电脑基本配置如下. 我的电脑 戴尔 OptiPlex 9020 Mini Tower操作系统 Windows 7 专业版 64位 SP1 Ubuntu 14.04 2.装系统的过程不再赘述. 可以 ...
- Activity竟然有两个onCreate方法,可别用错了
public class HomeDetailActivity { @Override protected void onCreate(@Nullable Bundle savedInstanceSt ...
- linux配置使用外部smtp发送邮件
mail命令需要设定mail.rc(或nail.rc)文件, set from=user@domain.comset smtp=smtp.domain.comset smtp-auth-user=us ...
- 熟练使用NTFS的文件链接技术
硬链接和软链接介绍: 硬连接指向的是i节点(iNode),而软连接指向的是路径(Path) ,又称符号链接.硬链接可理解为对i节点的引用,最初的文件名与所有的硬链接地位是对等的,比如为文件a建立了硬链 ...