Codeforces Round #313 B. Gerald is into Art(简单题)
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 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?
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.
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.
题意:给出一个大的矩形,然后再给出两个小的矩形,问能不能把这两个小的矩
形在不重叠的情况下放进大的矩形中,能的话输出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(简单题)的更多相关文章
- 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 ...
- Codeforces Round #313 C. Gerald's Hexagon(放三角形)
C. Gerald's Hexagon time limit per test 2 seconds memory limit per test 256 megabytes input standard ...
- Codeforces Round #519 by Botan Investments(前五题题解)
开个新号打打codeforces(以前那号玩废了),结果就遇到了这么难一套.touristD题用了map,被卡掉了(其实是对cf的评测机过分自信),G题没过, 700多行代码,码力惊人.关键是这次to ...
- 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/ ...
- 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 ...
- 【打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 ...
- 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 ...
- Codeforces Round #313 (Div. 2)(A,B,C,D)
A题: 题目地址:Currency System in Geraldion 题意:给出n中货币的面值(每种货币有无数张),要求不能表示出的货币的最小值.若全部面值的都能表示,输出-1. 思路:水题,就 ...
- Codeforces Round #313 (Div. 2) 解题报告
A. Currency System in Geraldion: 题意:有n中不同面额的纸币,问用这些纸币所不能加和到的值的最小值. 思路:显然假设这些纸币的最小钱为1的话,它就能够组成随意面额. 假 ...
随机推荐
- jQuery动态移除和绑定事件
function bindEvent() { //移除绑定事件 $('.btnsp').unbind('click'); //绑定事件 $('.btnsp').bind('click', functi ...
- java中引用对比C++指针
前置知识地址:https://blog.csdn.net/wangfei8348/article/details/51383805 重点在后面的引用对比实验(测试出内存地址,我很开心哈哈哈,客观给个好 ...
- ajax中文乱码解决(java)
方法1: 页面端发出的数据做一次encodeURI,服务器端使用new String(old.getBytes("iso8859-1"), "utf-8") 方 ...
- Django的forms包部分重要用法:
from django.forms import fields from django.forms import Form from django.forms import widgets 在view ...
- BUAA_OO_博客作业四
BUAA_OO_博客作业四 1 第四单元两次作业的架构设计 1.1 第13次作业 类图 作业要求:通过实现UmlInteraction这个官方提供的接口,来实现自己的UmlInteraction解 ...
- echarts的简单应用之(二)饼图
接上一篇文章: echarts的简单应用之(一)柱形图:https://www.cnblogs.com/jylee/p/9359363.html 本篇文章讲述饼图,撇过折线图不说,是因为折线图与柱形图 ...
- Python接口测试之报告(十五)
在本文章中,主要使用jenkins和编写的自动化测试代码,来生成漂亮的测试报告,关于什么是CI这些 我就不详细的介绍了,这里我们主要是实战为主. 首先搭建java的环境,这个这里不做介绍.搭建好jav ...
- 扫描局域网内所有主机和MAC地址的Shell脚本
#!/bin/bash #author: InBi #date: 2011-08-16 #website: http://www.itwhy.org/2011/08-20/939.html ##### ...
- POJ 2096 找bug 期望dp
题目大意: 一个人受雇于某公司要找出某个软件的bugs和subcomponents,这个软件一共有n个bugs和s个subcomponents,每次他都能同时随机发现1个bug和1个subcompon ...
- noip模拟赛 区间
分析:要遍历所有的区间,肯定是枚举左端点,然后再枚举右端点.关键是怎么高效地求区间&,|,一般而言是用前缀和的,但是&,|不满足区间可减性,所以可以考虑线段树?这道题不带修改操作,用线 ...