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 ...
随机推荐
- >>> FilterDispatcher <<< is deprecated! Please use the new filters!
在struts2.3.20下,web.xml中使用 会出现*********************************************************************** ...
- sp_executesql 使用
sp_executesql 比 之前的exec @sql 区别在可以实现参数的传入传出 如 declare @sql nvarchar(2000) declare @pid varchar(20) s ...
- Mysql事务,并发问题,锁机制
.什么是事务 事务是一条或多条数据库操作语句的组合,具备ACID,4个特点. 原子性:要不全部成功,要不全部撤销 隔离性:事务之间相互独立,互不干扰 一致性:数据库正确地改变状态后,数据库的一致性约束 ...
- bootstrap从phpcmsv9中数据库中取出照片达到自适应的效果
<script type="text/javascript"> $(".col-xs-12 img").addClass("carouse ...
- INADDR_ANY
INADDR_ANY就是指定地址为0.0.0.0的地址,这个地址事实上表示不确定地址,或“所有地址”.“任意地址”. 一般来说,在各个系统中均定义成为0值. 外文名 INADDR_ANY 别 名 所有 ...
- Nvidia Nsight + .NET
https://devtalk.nvidia.com/default/topic/804306/nsight-4-5-can-t-debug-net-applications/ http://comm ...
- JQM页面跳转,多种效果
<div data-role="page" id="pageone"> <div data-role="header"&g ...
- How to save milliseconds to DB in NHibernate
We need to configure Timestamp in Mapping. eg. Map(x => x.ResponseDate).CustomType("Timestam ...
- xheditor编辑器的使用
xheditor编辑器的使用 一个博客.cms网站都一定会用到一个html编辑器,刚好xmfdsh在做网站时候需要用到这类编辑器,在对比了之后,发现其实差不了多少,刚好一个不错的friend在用xhe ...
- C# MVC EF中匿名类使用
控制器中代码: var list = context.Says.Join( context.Users, a => a.UserId, b => b.Id, (a, b) => ne ...