• 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
  • 相关阅读:
    二分思想判断数组中是否有两数和为sum
    VC中#pragma warning指令
    (转)预编译头文件
    成为一名优秀程序员所需要知道的那些事
    SetThreadAffinityMask设置使用多核CPU的哪个核心
    DirectX 3D 设备丢失(lost device)的处理
    转载 CreateWaitableTimer和SetWaitableTimer函数
    转赵青《剑侠情缘网络版》开发回顾
    转载使用PostThreadMessage在Win32线程间传递消息
    VC使用CRT调试功能检测内存泄漏
  • 原文地址:https://www.cnblogs.com/zxhl/p/4669186.html
Copyright © 2020-2023  润新知