B. Gerald is into Art
time limit per test

2 seconds

memory limit per test

256 megabytes

input

standard input

output

standard output

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 test(s)
input
3 2
1 3
2 1
output
YES
input
5 5
3 3
3 3
output
NO
input
4 2
2 3
1 2
output
YES
Note

That's how we can place the pictures in the first test:

And that's how we can do it in the third one.

  题意:给出一个大的矩形,然后再给出两个小的矩形,问能不能把这两个小的矩

形在不重叠的情况下放进大的矩形中,能的话输出YES。否则输出NO





#include<iostream>
#include<stdio.h>
#include<string.h>
#include<stdlib.h> using namespace std; int main()
{
int n,m;
while(scanf("%d%d",&n,&m)!=EOF)
{
int a,b;
int c,d;
scanf("%d%d",&a,&b);
scanf("%d%d",&c,&d);
if(((a+c)<=n &&max(b,d)<=m)||((a+c)<=m &&max(b,d)<=n) || ((a+d)<=n &&max(b,c)<=m) || ((a+d)<=m &&max(b,c)<=n) || ((b+d)<=n &&max(a,c)<=m)||((b+d)<=m &&max(a,c)<=n) || ((b+c)<=n &&max(a,d)<=m) || ((b+c)<=m &&max(a,d)<=n))
{
printf("YES\n");
}
else
{
printf("NO\n");
} }
return 0;
}

Codeforces Round #313 B. Gerald is into Art(简单题)的更多相关文章

  1. Codeforces Round #313 A. Currency System in Geraldion(简单题)

    A. Currency System in Geraldion time limit per test 2 seconds memory limit per test 256 megabytes in ...

  2. Codeforces Round #313 C. Gerald&#39;s Hexagon(放三角形)

    C. Gerald's Hexagon time limit per test 2 seconds memory limit per test 256 megabytes input standard ...

  3. Codeforces Round #519 by Botan Investments(前五题题解)

    开个新号打打codeforces(以前那号玩废了),结果就遇到了这么难一套.touristD题用了map,被卡掉了(其实是对cf的评测机过分自信),G题没过, 700多行代码,码力惊人.关键是这次to ...

  4. 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/ ...

  5. 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 ...

  6. 【打CF,学算法——二星级】Codeforces Round #313 (Div. 2) B. Gerald is into Art(水题)

    [CF简单介绍] 提交链接:http://codeforces.com/contest/560/problem/B 题面: B. Gerald is into Art time limit per t ...

  7. Codeforces Round #313 (Div. 2) A B C 思路 枚举 数学

    A. Currency System in Geraldion time limit per test 2 seconds memory limit per test 256 megabytes in ...

  8. Codeforces Round #313 (Div. 2)(A,B,C,D)

    A题: 题目地址:Currency System in Geraldion 题意:给出n中货币的面值(每种货币有无数张),要求不能表示出的货币的最小值.若全部面值的都能表示,输出-1. 思路:水题,就 ...

  9. Codeforces Round #313 (Div. 2) 解题报告

    A. Currency System in Geraldion: 题意:有n中不同面额的纸币,问用这些纸币所不能加和到的值的最小值. 思路:显然假设这些纸币的最小钱为1的话,它就能够组成随意面额. 假 ...

随机推荐

  1. 1.C#冒泡排序

    冒泡 比较相邻的元素.如果第一个比第二个大,就交换他们两个. 对每一对相邻元素作同样的工作,从开始第一对到结尾的最后一对.这步做完后,最后的元素会是最大的数. 针对所有的元素重复以上的步骤,除了最后一 ...

  2. HDOJ 1846 Brave Game - 博弈入门

    题目地址:http://acm.hdu.edu.cn/showproblem.php?pid=1846 经典基础博弈,首先面对(m+1)的人一定会输,依次往后推即可: #include<iost ...

  3. 反连接NOT EXISTS子查询中有or 谓词连接条件SQL优化一例

    背景 今天在日常数据库检查中,发现一SQL运行时间特别长,于是抓取出来,进行优化. 优化前: 耗时:503s 返回:0 SQL代码 SELECT * FROM MM_PAYABLEMONEY_TD P ...

  4. Bash的循环结构(for和while)

    在bash有三中类型的循环结构表达方法:for,while,until.这里介绍常用的两种:for和while. for bash的for循环表达式和python的for循环表达式风格很像: for ...

  5. Python:用户自定义异常

    实际开发中,有时候系统提供的异常类型不能满足开发的需求.这时候你可以通过创建一个新的异常类来拥有自己的异常.异常类继承自 Exception 类,可以直接继承,或者间接继承. 1.自定义异常类型 #1 ...

  6. Buffer.allocUnsafe()

    Buffer.allocUnsafe(size) size {Number} 分配一个 size 字节大小的新的非零填充(non-zero-filled)的 Buffer.size 必须小于等于 re ...

  7. 74-A/D指标,Accumulation/Distribution,积累/派发线,离散指标.(2015.7.1)

    A/D指标,Accumulation/Distribution 积累/派发线,离散指标 观井映天 2015.7.1

  8. Vue如何使用vue-area-linkage实现地址三级联动效果

    很多时候我们需要使用地址三级联动,即省市区三级联动.网上有很多插件,在此介绍Vue的一款地区联动插件:vue-area-linkage,下面介绍如何使用这个插件实现地址联动效果:         1. ...

  9. CodeForces 221D Little Elephant and Array

    Little Elephant and Array Time Limit: 4000ms Memory Limit: 262144KB This problem will be judged on C ...

  10. 582. Kill Process

    Problem statement: Given n processes, each process has a unique PID (process id) and its PPID (paren ...