【打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 ...
随机推荐
- Silverlight:《Pro Silverlight5》读书笔记 之 Layout
Layout The Layout Containers The Panel Background By default, the Background of a layout panel is se ...
- U盘安装Centos7.0图解
用U盘安装Centos7.0 工具/原料 centos 7.0 64位系统:CentOS-7.0-1406-x86_64-DVD.iso ultraiso 一个至少8G的U盘 方法/步骤 1 1.先使 ...
- thinkphp5(tp5)中success跳转页面和弹窗问题解决
自己做了一个form页面,对其操作后,根据$this->success('提示信息',''),执行后是通过笑脸页面跳转,而不是在本页弹框后刷新.源码里带的原来的例子是弹出框刷新,为什么我自己做的 ...
- 写的一个split函数
vector<string> strsplit(const string& str) { vector<string> vec; string sstr1=str, s ...
- IIS7的CMD指令
AppCmd.exe工具所在目录 C:\windows\sytstem32\inetsrv\目录下 使用命令行管理IIS 7.0时,需要使用IIS7.0提供的全新管理工具AppCmd.exe.AppC ...
- 使用Springboot Email实现邮件发送
在springboot配置文件增加emai配置(此种方式不支持QQ邮箱): spring.datasource.type=com.alibaba.druid.pool.DruidDataSource ...
- grafana-zabbix图形简单配置
连接zabbix数据库 加入dashboard Home--Add--加入dashboad 设置dashboad 设置名字,和标签tag,tag可在输入后回车加入多个 加入简单的一张图,測试能否获取到 ...
- 将项目的版本控制从Vss迁移到Git
之前在Vs2008上一直使用的是Vss版本控制,现在将版本控制更改为Git 迁移原因是其他公司想要在我们公司开发的一个CRM系统做一些定制(个性化需求,将软件上的公司名称和链接更改为他们的或一些跟我们 ...
- Android Studio中mac上面的安装
Android Studio中mac上面的安装 学习了:https://blog.csdn.net/xianrenli38/article/details/79347170 http://www.an ...
- solr入门之參考淘宝搜索提示功能优化拼音加汉字搜索功能
首先看一下从淘宝输入搜索keyword获取到的一些数据信息: 第一张:使用拼音的全程来查询 能够看到提示的是匹配的转换的拼音的方式,看最后一个提示项 这里另一个在指定分类文件夹下搜索的功能,难道后台还 ...