Codeforces Round #313 (Div. 2) B. Gerald is into Art 水题

解决放置抽象艺术画作于特定尺寸板面上的问题
文章探讨了如何通过编程方法解决在特定尺寸的板面上放置两幅不同大小的抽象艺术画作的问题,确保画作能够平行于地面且不超出或重叠。通过输入板面和画作的尺寸,程序判断是否能成功放置。

B. Gerald is into Art

Time Limit: 20 Sec

Memory Limit: 256 MB

题目连接

http://codeforces.com/contest/560/problem/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?

Input

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

3 2
1 3
2 1

Sample Output

YES

HINT

 

题意

给你n*m的矩形,问你能否同事摆下n1*m1和n2*m2的矩形

题解:

就判断判断……

就搞啊搞

看代码吧

代码

#include <cstdio>
#include <cmath>
#include <cstring>
#include <ctime>
#include <iostream>
#include <algorithm>
#include <set>
#include <vector>
#include <sstream>
#include <queue>
#include <typeinfo>
#include <fstream>
#include <map>
#include <stack>
typedef long long ll;
using namespace std;
//freopen("D.in","r",stdin);
//freopen("D.out","w",stdout);
#define sspeed ios_base::sync_with_stdio(0);cin.tie(0)
#define test freopen("test.txt","r",stdin)
const int maxn=202501;
#define mod 1000000007
#define eps 1e-9
const int inf=0x3f3f3f3f;
const ll infll = 0x3f3f3f3f3f3f3f3fLL;
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 a1,b1,a2,b2,a3,b3;

int main(){
    cin>>a1>>b1>>a2>>b2>>a3>>b3;
    if (max(a2,a3)<=a1&&b2+b3<=b1||
    max(a2,a3)<=b1&&b2+b3<=a1||
    max(a2,b3)<=a1&&b2+a3<=b1||
    max(a2,b3)<=b1&&b2+a3<=a1||
    max(b2,a3)<=a1&&a2+b3<=b1||
    max(b2,a3)<=b1&&a2+b3<=a1||
    max(b2,b3)<=a1&&a2+a3<=b1||
    max(b2,b3)<=b1&&a2+a3<=a1) cout << "YES\n";
    else cout << "NO\n";
}

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值