【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. java多线程知识点汇总(二)多线程实例解析

    本实验主要考察多线程对单例模式的操作,和多线程对同一资源的读取,两个知识.实验涉及到三个类: 1)一个pojo类Student,包括set/get方法. 2)一个线程类,设置student的成员变量a ...

  2. linux集成开发环境

    Linux操作系统的种种集成开发环境 随着Linux的逐渐兴起,已经有为数众多的程序在上面驰骋了,许多开发环境(Development Environment)也应运而生.好的开发环境一定是集成了编辑 ...

  3. pytest文档3-pycharm运行pytest

    前言 上一篇pytest文档2-用例运行规则已经介绍了如何在cmd执行pytest用例,平常我们写代码在pycharm比较多 写完用例之后,需要调试看看,是不是能正常运行,如果每次跑去cmd执行,太麻 ...

  4. 仿LOL项目开发第六天

    仿LOL项目开发第六天 by草帽 OK,因为更新模块已经处理好了,接着开始登陆的编写.那么我们就需要状态机的管理. 所谓状态机就是在哪个状态执行那个状态的代码逻辑: 那么我们开始编写GameState ...

  5. AlphaGo:用机器学习技术古老的围棋游戏掌握AlphaGo: Mastering the ancient game of Go with Machine Learning

    AlphaGo: Mastering the ancient game of Go with Machine Learning Posted by David Silver and Demis Has ...

  6. MFC中显示图像的放大、缩小、移动功能

    StretchBlt函数直接对图片进行放大,缩小,显示位置变换. 这个函数有两种形态一种全局函数是这样的:  BOOL StretchBlt(HDC hdcDest, int nXOriginDest ...

  7. Servlet学习笔记(二):表单数据

    很多情况下,需要传递一些信息,从浏览器到 Web 服务器,最终到后台程序.浏览器使用两种方法可将这些信息传递到 Web 服务器,分别为 GET 方法和 POST 方法. 1.GET 方法:GET 方法 ...

  8. Android -- Spinner && AutoCompleteTextView

    Spinner 下拉选择框                                                                     Android给我们提供了一个Spi ...

  9. (C++)C++多态性中的静态绑定和动态绑定

    静态绑定和动态绑定是C++多态性的一种特性. 1.对象的静态类型和动态类型: 对象的静态类型: 对象在声明是采用的类型,在编译期确定: 对象的动态类型: 当前对象所指的类型,在运行期决定,对象的动态类 ...

  10. 用php编写我的第一段代码:hello world

    一.php环境的搭建 在编写php前,先搭建php环境,我选择了一站式安装软件WampServer,WampServer的下载地址:http://www.wampserver.com/ WampSer ...