CF# 260 A. Laptops

CF# 260 A. Laptops

大家好,又见面了,我是全栈君。

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).

Sample test(s)
input
2
1 2
2 1

output
Happy Alex


cf第一题必定非常水这题,仅仅要读入数据后按价格排序然后找到一对逆序的输出就好了

#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<limits.h>
using namespace std;
const int maxn=1e5+10;
struct node{
    int x,y;
}e[maxn];
int cmp(node l1,node l2)
{
    return l1.x<l2.x;
}
int main()
{
    int n;
    while(~scanf("%d",&n))
    {
        for(int i=0;i<n;i++)
            scanf("%d%d",&e[i].x,&e[i].y);
        sort(e,e+n,cmp);
        int flag=0;
        for(int i=1;i<n;i++)
        {
            if(e[i].x>e[i-1].x&&e[i].y<e[i-1].y)
            {
                flag=1;
                break;
            }
        }
        if(flag)
            cout<<"Happy Alex"<<endl;
        else
            cout<<"Poor Alex"<<endl;
    }
    return 0;
}

版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请联系我们举报,一经查实,本站将立刻删除。

发布者:全栈程序员-站长,转载请注明出处:https://javaforall.net/116000.html原文链接:https://javaforall.net

(0)
全栈程序员-站长的头像全栈程序员-站长


相关推荐

  • 基于jsp和基于web的区别_java发送短信

    基于jsp和基于web的区别_java发送短信最新web/java/jsp实现发送手机短信验证码和邮箱验证码的注册登录功能(详细)最近几天有人需要帮忙做一个关于发送验证码的功能,之前没有做过,于是我鼓捣一阵子,记录一下关于web项目中注册登录常用的手机验证码和邮箱验证码的发送。作为一个演示项目,我没有使用任何框架,用了一个简单的jsp+Servlet,当然用boostrap美化了一下。代码带有注释,非常简单易懂。一、手机验证码由于手机…

    2022年10月13日
    0
  • python license函数_Python 自动获取License文件

    python license函数_Python 自动获取License文件1importos2importsys3importjson4importtime567#returndependenciesstring8#forexample:9#'”axios”:”^0.19.2″,”myjs-common”:”^1.0.6″,”oneport”:”^1.0.2″’10defreadPackageJson(filename):11de…

    2022年7月26日
    12
  • 深度学习—1.认识深度学习

    深度学习—1.认识深度学习

    2021年10月5日
    64
  • ideaIU-2022.01.4 激活码-激活码分享2022.03.13

    (ideaIU-2022.01.4 激活码)本文适用于JetBrains家族所有ide,包括IntelliJidea,phpstorm,webstorm,pycharm,datagrip等。IntelliJ2021最新激活注册码,破解教程可免费永久激活,亲测有效,下面是详细链接哦~https://javaforall.net/100143.html…

    2022年4月2日
    244
  • Pytest(13)命令行参数–tb的使用

    Pytest(13)命令行参数–tb的使用前言pytest使用命令行执行用例的时候,有些用例执行失败的时候,屏幕上会出现一大堆的报错内容,不方便快速查看是哪些用例失败。–tb=style参数可以设置报错的时候回溯打印内容,可以设置参

    2022年7月30日
    5
  • c语言rtp协议,RTP系列:RTP协议详解和分析

    c语言rtp协议,RTP系列:RTP协议详解和分析1、RTP概述实时传输协议(Real-timeTransportProtocol或简写RTP)是一个网络传输协议,作为因特网标准在RFC3550(该文档的旧版本是RFC1889)有详细说明。RFC3551(STD65,旧版本是RFC1890)详细描述了使用最小控制的音频和视频会议。RTP协议详细说明了在互联网上传递音频和视频的标准数据包格式。它一开始被设计为一个多播协议,但后来被用在…

    2022年6月28日
    72

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注

关注全栈程序员社区公众号