Codeforces 260 A - A. Laptops
题目链接:http://codeforces.com/contest/456/problem/A
解题报告:有n种电脑,给出每台电脑的价格和质量,要你判断出有没有一种电脑的价格小于另一种电脑但质量却大于另一台电脑的情况。
把输入排个序就可以了,但是我比赛的时候排序只是按照价格排序了,锁定代码之后发现了这个错误,但已经改不了了,但是最后居然AC了,说明CF的数据也是有问题的。
#include<cstdio>
#include<cstring>
#include<iostream>
#include<algorithm>
#include<cmath>
#include<deque>
#include<queue>
#include<set>
#include<map>
using namespace std;
#define maxn 100005
struct node
{
int a,b;
}A[maxn]; bool cmp(node a,node b)
{
if(a.a == b.a) return a.b <= b.b;
return a.a < b.a;
}
int main()
{
int n;
while(scanf("%d",&n)!=EOF)
{
for(int i = ;i < n;++i)
scanf("%d%d",&A[i].a,&A[i].b);
sort(A,A+n,cmp);
int hehe = A[].b,ans = ;
for(int i = ;i < n - ;++i)
if(A[i].b > A[i+].b)
{
ans = ;
break;
}
printf(ans? "Happy Alex\n":"Poor Alex\n");
}
return ;
}
Codeforces 260 A - A. Laptops的更多相关文章
- [codeforces 260]B. Ancient Prophesy
[codeforces 260]B. Ancient Prophesy 试题描述 A recently found Ancient Prophesy is believed to contain th ...
- Codeforces 260 C. Boredom
题目链接:http://codeforces.com/contest/456/problem/C 解题报告:给出一个序列,然后选择其中的一个数 k 删除,删除的同时要把k - 1和k + 1也删除掉, ...
- Codeforces 260 B. Fedya and Maths
题目链接:http://codeforces.com/contest/456/problem/B 解题报告:输入一个n,让你判断(1n + 2n + 3n + 4n) mod 5的结果是多少?注意n的 ...
- codeforces #260 DIV 2 C题Boredom(DP)
题目地址:http://codeforces.com/contest/456/problem/C 脑残了. .DP仅仅DP到了n. . 应该DP到10w+的. . 代码例如以下: #include & ...
- codeforces 260 div2 C题
C题就是个dp,把原数据排序去重之后得到新序列,设dp[i]表示在前i个数中取得最大分数,那么: if(a[i] != a[i-1]+1) dp[i] = cnt[a[i]]*a[i] + dp[ ...
- codeforces 260 div2 B题
打表发现规律,对4取模为0的结果为4,否则为0,因此只需要判断输入的数据是不是被4整出即可,数据最大可能是100000位的整数,判断能否被4整出不能直接去判断,只需要判断最后两位(如果有)或一位能否被 ...
- codeforces 260 div2 A,B,C
A:水的问题.排序结构.看看是否相同两个数组序列. B:他们写出来1,2,3,4,的n钍对5余.你会发现和5环节. 假设%4 = 0,输出4,否则输出0. 写一个大数取余就过了. B. Fedya a ...
- Codeforces Round #260 (Div. 2)A. Laptops
A. Laptops time limit per test 1 second memory limit per test 256 megabytes input standard input out ...
- Codeforces Round #260 (Div. 2)AB
http://codeforces.com/contest/456/problem/A A. Laptops time limit per test 1 second memory limit per ...
随机推荐
- UVA11987Almost Union-Find(并查集删除节点)
题目链接 题意:n个数(即1-n)和m个操作: 1表示把x和y合并,2表示把x移到y集合里面,3表示统计x集合的元素个数 1,3好说,关键是2操作,可以先把2删除掉,删除的操作可以找一个其他的数字来取 ...
- Docker入门教程(二)命令
Docker入门教程(二)命令 [编者的话]DockerOne组织翻译了Flux7的Docker入门教程,本文是系列入门教程的第二篇,介绍了Docker的基本命令以及命令的用法和功能. 在Docker ...
- jquery selector 基础
转自:http://www.cnblogs.com/zwl12549/archive/2008/08/09/1264163.html query的这套选择符是比较帅气的,借用了XPath2.0和CSS ...
- Yocto开发笔记之《Tip-设置程序开机启动》(QQ交流群:519230208)
QQ群:519230208,为避免广告骚扰,申请时请注明 “开发者” 字样 IMX6UL,转载请注明出处 ============================================== ...
- VGA 视频输出
VGA Video Output by Nathan Ickes Introduction VGA is a high-resolution video standard used mostly fo ...
- Runner站立会议02
开会时间:21.10~21.30 地点:二教103 今天做了什么:学习五大布局的使用方法 明天准备做什么:学习数据的存储 遇到的困难:知识点太多,信心受挫 站立会议图: 燃尽图:
- CodeForces 710A King Moves(水题-越界问题)
题目链接:http://codeforces.com/problemset/problem/710/A 题目大意:在一个棋盘中给出一个位置,判断该位置周围8个点还有几个点可以摆放棋子. AC代码解释解 ...
- C#----使用WindowsMediaPlayer 同时播放多个声音
使用Windows Media Player 其实就是使用组件AxWindowsMediaPlayer. 添加两个引用:Interop.WMPLib.dll和AxInterop.WMPLib.dll. ...
- ecshop if标签,超过N条,就输出记录 elseif、库存显示方式
<!--商品详情右侧 相关商品推荐--> <!-- {if $related_goods} --> <!--{foreach from=$related_goods it ...
- Multiple sequence alignment Benchmark Data set
Multiple sequence alignment Benchmark Data set 1. 汇总: 序列比对标准数据集: http://www.drive5.com/bench/ This i ...