【CF简单介绍】

提交链接:http://codeforces.com/contest/560/problem/B

题面:

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 ana1 × b1
rectangle, the paintings have shape of aa2 × b2 anda3 × 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 andb1 — the sides of the board. Next two lines contain numbersa2, b2, a3
andb3 — the sides of the paintings. All numbersai, bi in the
input are integers and fit into the range from1 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.

解题:

就是看能不能把两块画。放进板内,要求画必须平行于板。

代码:

#include <iostream>
#include <algorithm>
#include <cstdio>
using namespace std;
int main()
{
int l1,w1,l2,w2,l3,w3;
scanf("%d%d",&l1,&w1);
scanf("%d%d",&l2,&w2);
scanf("%d%d",&l3,&w3);
bool flag=false;
if((l2+l3)<=l1&&(w2<=w1&&w3<=w1))
flag=true;
else if((l2+w3)<=l1&&(w2<=w1)&&(l3<=w1))
flag=true;
else if((w2+l3)<=l1&&(l2<=w1)&&(w3<=w1))
flag=true;
else if((w2+w3)<=l1&&(l2<=w1&&l3<=w1))
flag=true;
else if((w2+w3)<=w1&&(l2<=l1)&&(l3<=l1))
flag=true;
else if((w2+l3)<=w1&&(l2<=l1)&&(w3<=l1))
flag=true;
else if((l2+w3)<=w1&&(w2<=l1)&&(l3<=l1))
flag=true;
else if((l2+l3)<=w1&&(w2<=l1)&&(w3<=l1))
flag=true;
if(flag)printf("YES\n");
else printf("NO\n");
return 0;
}

【打CF,学算法——二星级】Codeforces Round #313 (Div. 2) B. Gerald is into Art(水题)的更多相关文章

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

  2. Codeforces Round #313 (Div. 2) A. Currency System in Geraldion 水题

    A. Currency System in Geraldion Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/c ...

  3. Codeforces Round #368 (Div. 2) A. Brain's Photos (水题)

    Brain's Photos 题目链接: http://codeforces.com/contest/707/problem/A Description Small, but very brave, ...

  4. Codeforces Round #373 (Div. 2) C. Efim and Strange Grade 水题

    C. Efim and Strange Grade 题目连接: http://codeforces.com/contest/719/problem/C Description Efim just re ...

  5. Codeforces Round #185 (Div. 2) A. Whose sentence is it? 水题

    A. Whose sentence is it? Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/ ...

  6. Codeforces Round #373 (Div. 2) A. Vitya in the Countryside 水题

    A. Vitya in the Countryside 题目连接: http://codeforces.com/contest/719/problem/A Description Every summ ...

  7. Codeforces Round #371 (Div. 2) A. Meeting of Old Friends 水题

    A. Meeting of Old Friends 题目连接: http://codeforces.com/contest/714/problem/A Description Today an out ...

  8. Codeforces Round #355 (Div. 2) B. Vanya and Food Processor 水题

    B. Vanya and Food Processor 题目连接: http://www.codeforces.com/contest/677/problem/B Description Vanya ...

  9. 【打CF,学算法——三星级】Codeforces Round #313 (Div. 2) C. Gerald&#39;s Hexagon

    [CF简单介绍] 提交链接:http://codeforces.com/contest/560/problem/C 题面: C. Gerald's Hexagon time limit per tes ...

随机推荐

  1. ice地址

    http://www.zeroc.com/download/eclipse

  2. LTE试题

    D 如果出现eNB的告警1018007“小区退服,光口不可用”,不可能是以下哪种原因造成的?(          ) 基带板上Ir接口光模块损坏 基带板上Ir接口光模块被拔出 基带板上Ir接口光模块型 ...

  3. Linux进程间通信—套接字

    六.套接字(socket) socket也是一种进程间的通信机制,不过它与其他通信方式主要的区别是:它可以实现不同主机间的进程通信.一个套接口可以看做是进程间通信的端点(endpoint),每个套接口 ...

  4. trident介绍

    (一)理论基础 很多其它理论以后再补充,或者參考书籍 1.trident是什么? Trident is a high-level abstraction for doing realtime comp ...

  5. 2 cocos2dx 3.0 源码分析-Director

    Director 导演类, 这个类在整个引擎中担当着最重要的角色, 先看看它是如何初始化的,它共管理了哪些内容呢?    1初始化- 更新处理Scheduler   Scheduler 这个类负责用户 ...

  6. delegate和event的区别 (zz)

    一. delegate C#代理实际上类似于C++中的函数指针,因为C#中不存在指针,所以用代理可以完成一些原来在C++中用函数指针完成的操作,例如传递一个类A的方法m给另一个类B的对象,使得类B的对 ...

  7. 转: SSH 公钥认证

    转: http://blog.knownsec.com/2012/05/ssh-%E5%85%AC%E9%92%A5%E8%AE%A4%E8%AF%81/ SSH 公钥认证 2012-05-15 简介 ...

  8. 成都PHP开发project师薪资信息

    这是成都的PHPproject开发师招聘.如图所见,最低的月薪是4K,最高的是35W,PHP开发工程师正处于炙手可热的发展趋势,还愁拿不到高薪,找不到工作的你,还犹豫什么,机会就在眼前,成都传智播客P ...

  9. [Functional Programming] Write a simple version of Maybe

    Maybe has two types: Just / Nothing. Just() will just return the value that passed in. Nothing retur ...

  10. Makefile 编译静态库

    CC = gcc AR = ar FLAGS = -Wall -lpthread CLOUD = cloud_server OBJ += cloud_server.o LIB = libccloud. ...