codeforce 456A Laptops

本文探讨了一个关于笔记本电脑价格与质量之间关系的问题,通过编程验证了是否存在价格较低但质量较高的情况,以此来判断Alex的观点是否正确。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

题目描述:

One day Dima and Alex had an argument about the price and quality of laptops. Dima thinks that the more expensive a laptop is, the better it is. Alex disagrees. Alex thinks that there are two laptops, such that the price of the first laptop is less (strictly smaller) than the price of the second laptop but the quality of the first laptop is higher (strictly greater) than the quality of the second laptop.

Please, check the guess of Alex. You are given descriptions of n laptops. Determine whether two described above laptops exist.

Input

The first line contains an integer n (1 ≤ n ≤ 105) — the number of laptops.

Next n lines contain two integers each, ai and bi (1 ≤ ai, bi ≤ n), where ai is the price of the i-th laptop, and bi is the number that represents the quality of the i-th laptop (the larger the number is, the higher is the quality).

All ai are distinct. All bi are distinct.

Output

If Alex is correct, print "Happy Alex", otherwise print "Poor Alex" (without the quotes).

Examples

Input

2
1 2
2 1

Output

Happy Alex

题目大意:

首先注意一个大前提:1 ≤ ai, bi ≤ n     ,这里只要满足低消费高回报就可以输出“Happy Alex”,又因为ai , bi 范围的限制,ai=bi是消费与回报相等的情况,所以只要输入的数据中有一行ai不等于bi便可以输出“Happy Alex”

代码:

#include <cstdio>
#include <iostream>
#include <cstring>
#include <algorithm>
#define LL long long
using namespace std;
const int maxn=500000;
int main()
{
   int n,t,k;
   int a,b;
   while(scanf("%d",&n)!=EOF)

    {
        k=0;
        for(int i=0;i<n;i++)
        {
          scanf("%d%d",&a,&b);

           if(a!=b)k=1;
        }
         if(k)
           cout<<"Happy Alex"<<endl;
           else cout<<"Poor Alex"<<endl;

    }
   return 0;
}

//另,不太理解为什么把a,b换为a[],b[]不对

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值