zoukankan      html  css  js  c++  java
  • codedorces 260 div2 A题

    水题,扫描一遍看是否出现价格低质量高的情况。
    #include<cstdio>
    #include<string>
    #include<vector>
    #include<cstring>
    #include<iostream>
    #include<algorithm>
    using namespace std;
    struct Node{
        int a, b;
        Node(int a, int b){
            this->a = a;
            this->b = b;
        }
        bool operator < (const Node &A) const{
            if(a == A.a) return b <  A.b;
            return a < A.a;
        }
    };
    vector<Node>V;
    int main(){
        int n, t1, t2;
        scanf("%d", &n);
        for(int i = 0;i < n;i ++){
            scanf("%d%d",&t1, &t2);
            V.push_back(Node(t1, t2));
        }
        sort(V.begin(), V.end());
        int flag = 0;
        for(int i = 1;i < n;i ++){
            if(V[i-1].b > V[i].b){
                flag = 1;
                break;
            }
        }
        if(!flag) printf("Poor Alex
    ");
        else printf("Happy Alex
    ");
    }

  • 相关阅读:
    1
    iulg
    实验10
    作业5 指针应用
    作业4 函数应用
    实验9 指针
    实验 8 数组2
    实验7
    实验6 数组1
    实验5
  • 原文地址:https://www.cnblogs.com/anhuizhiye/p/3933121.html
Copyright © 2011-2022 走看看