【打CF,学算法——二星级】Codeforces Round #313 (Div. 2) B. Gerald is into Art(水题)
提交链接:http://codeforces.com/contest/560/problem/B
题面:
2 seconds
256 megabytes
standard input
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?
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.
If the paintings can be placed on the wall, print "YES" (without the quotes), and if they cannot, print "NO" (without the quotes).
3 2
1 3
2 1
YES
5 5
3 3
3 3
NO
4 2
2 3
1 2
YES
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(水题)的更多相关文章
- 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 ...
- 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 ...
- Codeforces Round #368 (Div. 2) A. Brain's Photos (水题)
Brain's Photos 题目链接: http://codeforces.com/contest/707/problem/A Description Small, but very brave, ...
- 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 ...
- 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/ ...
- 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 ...
- 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 ...
- 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 ...
- 【打CF,学算法——三星级】Codeforces Round #313 (Div. 2) C. Gerald's Hexagon
[CF简单介绍] 提交链接:http://codeforces.com/contest/560/problem/C 题面: C. Gerald's Hexagon time limit per tes ...
随机推荐
- android基础学习-Fragment和eclipse快捷键
使用Fragment的原因 1. Activity间的切换不流畅 2. 模块化Activity,方便做局部动画(有时为了到达这一点要把多个布局放到一个activity里面,现在可以用多Fragment ...
- 海思hi3518 opencv测试
2.4.9的opencv 安装好交叉编译后,用Cmake 配置opencv 修改CMakeCache.txtCMAKE_EXE_LINKER_FLAGS:STRING=-lpthread -lrt - ...
- TensorFlowIO操作(三)------图像操作
图像操作 图像基本概念 在图像数字化表示当中,分为黑白和彩色两种.在数字化表示图片的时候,有三个因素.分别是图片的长.图片的宽.图片的颜色通道数.那么黑白图片的颜色通道数为1,它只需要一个数字就可以表 ...
- jQuery/javascript实现IP/Mask自动联想功能
之前做一个云计算的项目,涉及到一个安全组自动联想的功能,思想是这样的: 安全组规则之间是可以相互引用的,也可以自己是自己手动输入的ip/mask,这时候可以加一个功能,实现securityGroupI ...
- c# 使用api函数 ShowWindowAsync 控制窗体
1.需要匯入 System.Runtime.InteropServices 命名空間 2.宣告 ShowWindowAsync 函數 [DllImport("user32.dll" ...
- Mapper 与 Reducer 解析
1 . 旧版 API 的 Mapper/Reducer 解析 Mapper/Reducer 中封装了应用程序的数据处理逻辑.为了简化接口,MapReduce 要求所有存储在底层分布式文件系统上的数据均 ...
- 使用dulilib DirectUI库(一)
1.在创建的窗口类里面 需要继承CWindowWnd.INotifyUI 对于CWindowWnd里面的方法: 实现;,重载virtualUINTGetClassStyle()const;返回窗口的风 ...
- 转:RSA算法原理说明
转:http://www.joenchen.com/archives/979 RSA算法可以说在我们使用计算机的每一方面都在发挥着作用, EXE文件的签名算法用的是SHA1 + RSA. 我们每天登陆 ...
- (剑指Offer)面试题13:在O(1)时间内删除链表结点
题目: 在给定单向链表的头指针和一个结点指针,定义一个函数在O(1)时间内删除该结点.链表结点与函数的定义如下: struct ListNode{ int val; ListNode* next; } ...
- Cocos2d-x -- 如何让背景从上到下滚动
1. 首先,声明一个2个大小的sprite数组 class GameScreen : public cocos2d::Layer { public: ... cocos2d::Sprite *back ...