zoukankan      html  css  js  c++  java
  • Codeforces Round #313 (Div. 2)B.B. Gerald is into Art

    B. Gerald is into Art

    Time Limit: 20 Sec

    Memory Limit: 256 MB

    题目连接

    http://codeforces.com/problemset/problem/560/B

    Description

    Gerald bought two very rare paintings at the Sotheby's auction and he now wants to hang them on the wall. For that he bought a special board to attach it to the wall and place the paintings on the board. The board has shape of an a1 × b1 rectangle, the paintings have shape of a a2 × b2 and a3 × b3 rectangles.

    Since the paintings are painted in the style of abstract art, it does not matter exactly how they will be rotated, but still, one side of both the board, and each of the paintings must be parallel to the floor. The paintings can touch each other and the edges of the board, but can not overlap or go beyond the edge of the board. Gerald asks whether it is possible to place the paintings on the board, or is the board he bought not large enough?

    intput

    The first line contains two space-separated numbers a1 and b1 — the sides of the board. Next two lines contain numbers a2, b2, a3 andb3 — the sides of the paintings. All numbers ai, bi in the input are integers and fit into the range from 1 to 1000.

    Output

    If the paintings can be placed on the wall, print "YES" (without the quotes), and if they cannot, print "NO" (without the quotes).

    Sample Input

    4 2
    2 3
    1 2

    Sample Output

    YES

    HINT

    题意

        是否能将下面两个矩形放入第一个矩形

    题解:

        无脑

    代码

    #include <iostream>
    #include <stdio.h>
    #include <vector>
    #include <algorithm>
    #include <string>
    #include <stack>
    #include <math.h>
    #include <vector>
    #include <string.h>
    using namespace std;
    
    typedef __int64 ll;
    const int INF = (int)1E9+10;
    inline ll read()
    {
        ll x=0,f=1;
        char ch=getchar();
        while(ch<'0'||ch>'9')
        {
            if(ch=='-')f=-1;
            ch=getchar();
        }
        while(ch>='0'&&ch<='9')
        {
            x=x*10+ch-'0';
            ch=getchar();
        }
        return x*f;
    }
    
    //*******************************
    
    
    int main()
    {
        int a1,a2,a3,b1,b2,b3;
        int a,b;
        scanf("%d%d",&a,&b);
        scanf("%d%d",&a2,&b2);
        scanf("%d%d",&a3,&b3);
    
    
        if((max(a2,b3)<=a&&(b2+a3)<=b)||
            (max(a2,b3)<=b&&(b2+a3)<=a)||
            (max(b2,b3)<=b&&(a3+a2)<=a)||
            (max(b2,b3)<=a&&(a3+a2)<=b)||
           (max(a2,a3)<=a&&(b2+b3)<=b)||
           (max(a2,a3)<=b&&(b2+b3)<=a)||
           (max(b2,a3)<=a&&(b3+a2)<=b)||
           (max(b2,a3)<=b&&(b3+a2)<=a))
        {
            printf("YES
    ");
        }
        else printf("NO
    ");
        return 0;
    }
    View Code
  • 相关阅读:
    CMLLVDS
    js获取url中的参数(解决中文乱码)
    解决跳转出现 No input file specified.
    ThinkPHP关联模型详解
    Thinkphp表单自动验证
    手机号登录注册
    JS实现每隔一段时间数量增加或减少
    文章或者观点说说等点赞功能实现(thinkphp)
    thinkphp整合Ueditor编辑器
    点击切换状态 类似开关按钮
  • 原文地址:https://www.cnblogs.com/zxhl/p/4669186.html
Copyright © 2011-2022 走看看