• BZOJ3715: [PA2014]Lustra


    【传送门:BZOJ4034


    简要题意:

      给出n个工厂,并给出每个工厂可以生产的镜子的最大、最小宽度和最大、最小高度

      判断是否存在一个工厂能够生产出其他工厂能够生产的镜子


    题解:

      水题,直接排序,然后判断是否存在不合理情况就行了


    参考代码:

    #include<cstdio>
    #include<cstring>
    #include<cstdlib>
    #include<algorithm>
    #include<cmath>
    using namespace std;
    struct node
    {
        int w1,w2,h1,h2;
    }a[110000];
    bool cmp(node n1,node n2)
    {
        if(n1.w1<n2.w1) return true;
        if(n1.w1>n2.w1) return false;
        if(n1.w2>n2.w2) return true;
        if(n1.w2<n2.w2) return false;
        if(n1.h1<n2.h1) return true;
        if(n1.h1>n2.h1) return false;
        if(n1.h2>n2.h2) return true;
        if(n1.h2<n2.h2) return false;
        return false;
    }
    int main()
    {
        int T;
        scanf("%d",&T);
        while(T--)
        {
            int n;scanf("%d",&n);
            for(int i=1;i<=n;i++) scanf("%d%d%d%d",&a[i].w1,&a[i].w2,&a[i].h1,&a[i].h2);
            sort(a+1,a+n+1,cmp);
            bool bk=true;
            for(int i=2;i<=n;i++)
            {
                if(a[i].w1<a[1].w1||a[i].w2>a[1].w2||a[i].h1<a[1].h1||a[i].h2>a[1].h2)
                {
                    bk=false;
                    break;
                }
            }
            if(bk==true) printf("TAK
    ");
            else printf("NIE
    ");
        }
        return 0;
    }

     

  • 相关阅读:
    压缩感知(CS)
    在linux服务器上配置anaconda和Tensorflow,并运行
    opencv基本操作
    在windows10下vs2017配置opencv4.0.0
    枚举
    图片居中
    css初始化
    常用颜色
    css三大布局
    盒子宽度
  • 原文地址:https://www.cnblogs.com/Never-mind/p/8687904.html
Copyright © 2020-2023  润新知