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 ...
随机推荐
- UVA1213Sum of Different Primes(素数打表 + DP)
题目链接 题意:选择k个素数,使得和为N(1120)的方案数: 筛选出 <= N 的素数,然后就背包 写的时候没初始dp[0][0] = 1;而且方案数也没相加,真是弱逼 #include &l ...
- IOS VFL屏幕自适应
-(void)fun1{ //注意使用VFL,不用设置视图的frame UIView *view = [[UIView alloc] init]; view.backgroundColor = [UI ...
- Altium Designer 多个输出相连等问题报错解决方法
问题: Altium Designer软件中,项目编译时,Message面板出现,如下错误: Net NetR121_1 contains multiple Output Pins; PC10 con ...
- spring-data-jpa 的@Query注解的使用
// ------------------------------------ 使用 @Query 注解 // 没有参数的查询 @Query("select p from Person p ...
- uC/OS-II标志(flag)块
/*************************************************************************************************** ...
- js021-Ajax与Comet
js021-Ajax与Comet 本章内容: 使用XMLHttpRequet对象 使用XMLHttpRequet事件 跨域Ajax通信的限制 Ajax技术的核心是XMLHttpRequet对象 21. ...
- JavaWeb学习笔记——JSTL核心标签库
- Embedding Scripts
Mono http://www.mono-project.com/docs/advanced/embedding/ http://www.mono-project.com/docs/advanced/ ...
- Favorite Games
Samurai II: Vengeance: http://www.madfingergames.com/games
- yourphp的edit,updata,dele
参考文件Yourphp\Lib\Action\User\PostAction.class.php public function add() { $form=new Form(); $form-> ...