Codeforces Gym 100531G Grave 水题
Problem G. Grave
题目连接:
http://codeforces.com/gym/100531/attachments
Description
Gerard develops a Halloween computer game. The game is played on a rectangular graveyard with a
rectangular chapel in it. During the game, the player places new rectangular graves on the graveyard.
The grave should completely fit inside graveyard territory and should not overlap with the chapel. The
grave may touch borders of the graveyard or the chapel.
Gerard asked you to write a program that determines whether it is possible to place a new grave of given
size or there is no enough space for it.
Input
The first line of the input file contains two pairs of integers: x1, y1, x2, y2 (−109 ≤ x1 < x2 ≤ 109
;
−109 ≤ y1 < y2 ≤ 109
) — coordinates of bottom left and top right corners of the graveyard. The second
line also contains two pairs of integers x3, y3, x4, y4 (x1 < x3 < x4 < x2; y1 < y3 < y4 < y2) —
coordinates of bottom left and top right corners of the chapel.
The third line contains two integers w, h — width and height of the new grave (1 ≤ w, h ≤ 109
). Side
with length w should be placed along OX axis, side with length h — along OY axis
Output
The only line of the output file should contain single word: “Yes”, if it is possible to place the new grave,
or “No”, if there is not enough space for it.
Sample Input
1 1 11 8
2 3 8 6
3 2
Sample Output
Yes
Hint
题意
有一个矩形,然后在里面放一个矩阵,问你还能不能再放进去一个w*h的矩阵进去
题解:
水题,只有四个空位子,把这四个位置都判断一下就好
代码
#include<bits/stdc++.h>
using namespace std;
int x1,y1,x2,y2;
int x3,y3,x4,y4;
int w,h;
int main()
{
freopen("grave.in","r",stdin);
freopen("grave.out","w",stdout);
cin>>x1>>y1>>x2>>y2;
cin>>x3>>y3>>x4>>y4;
cin>>w>>h;
int l = x2 - x1;
int H = y2 - y1;
if(l>=w&&y3-y1>=h)
return puts("Yes");
if(l>=w&&y2-y4>=h)
return puts("Yes");
if(H>=h&&x3-x1>=w)
return puts("Yes");
if(H>=h&&x2-x4>=w)
return puts("Yes");
return puts("No");
}
Codeforces Gym 100531G Grave 水题的更多相关文章
- Gym 100531G Grave(水题)
题意:给定一个大矩形,再给定在一个小矩形,然后给定一个新矩形的长和高,问你能不能把这个新矩形放到大矩形里,并且不与小矩形相交. 析:直接判定小矩形的上下左右四个方向,能不能即可. 代码如下: #pra ...
- Codeforces Gym 100286I iSharp 水题
Problem I. iSharpTime Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://acm.hust.edu.cn/vjudge/contest/ ...
- CodeForces Gym 100685C Cinderella (水题)
题意:给定 n 个杯子,里面有不同体积的水,然后问你要把所有的杯子的水的体积都一样,至少要倒少多少个杯子. 析:既然最后都一样,那么先求平均数然后再数一下,哪个杯子的开始的体积就大于平均数,这是一定要 ...
- codeforces 706A A. Beru-taxi(水题)
题目链接: A. Beru-taxi 题意: 问那个taxi到他的时间最短,水题; AC代码: #include <iostream> #include <cstdio> #i ...
- codeforces 569B B. Inventory(水题)
题目链接: B. Inventory time limit per test 1 second memory limit per test 256 megabytes input standard i ...
- Codeforces 489A SwapSort (水题)
A. SwapSort time limit per test 1 second memory limit per test 256 megabytes input standard input ou ...
- UVaLive 6591 && Gym 100299L Bus (水题)
题意:略. 析:不解释,水题. 代码如下: #pragma comment(linker, "/STACK:1024000000,1024000000") #include < ...
- codeforces 688A A. Opponents(水题)
题目链接: A. Opponents time limit per test 1 second memory limit per test 256 megabytes input standard i ...
- CodeForces 534B Covered Path (水题)
题意:给定两个速度,一个一初速度,一个末速度,然后给定 t 秒时间,还每秒速度最多变化多少,让你求最长距离. 析:其实这个题很水的,看一遍就知道怎么做了,很明显就是先从末速度开始算起,然后倒着推. 代 ...
随机推荐
- c#枚举自定义,用于数据绑定。 z
[AttributeUsage(AttributeTargets.Field | AttributeTargets.Property | AttributeTargets.Enum)] public ...
- Delphi 串口使用校验位
平时都用的8N1的模式,这次使用了校验位,因此串口的初始化工作需要改变 #ifdef RT_USING_UART2 USART_InitStructure.USART_BaudRate = 9600; ...
- jquery自动将form表单封装成json的具体实现
前端页面:<span style="font-size:14px;"> <form action="" method="post&q ...
- cdh5.4、cm5.4 安装详细步骤
安装准备: 1.centos6.5 64位 虚拟机,内存分配4G.硬盘位20G 2.cm5.4 cdh5.4 包 安装步骤 一.centos安装完后,进行系统配置 1.关闭防火墙 service ip ...
- HDOJ-ACM1009(JAVA) (传说中的贪心算法)分为数组实现 和 封装类实现
转载声明:原文转自:http://www.cnblogs.com/xiezie/p/5564311.html 这个道题有几点要注意的: 数组存放的类型:float或double 打印的格式:(如果只是 ...
- nodejs save遇到的一个坑
混合类型因为没有特定约束,因此可以任意修改,一旦修改了原型,则必须 调用markModified() >>> person.anything = {x:[3,4,{y:'change ...
- searchDisplayController 时引起的数组越界
当 [searchDisplayController.searchResultsTableView setSeparatorStyle:UITableViewCellSeparatorStyleNo ...
- IOS中 什么是UITableView的索引放大镜字符
IOS中 什么是UITableView的索引放大镜字符 [_dataSource addObject:UITableViewIndexSearch]; 版权声明:本文为博主原创文章,未经博主允许不得转 ...
- c++面试题总结(2)
1. C中static有什么作用 (1)隐藏. 当我们同时编译多个文件时,所有未加static前缀的全局变量和函数都具有全局可见性,故使用static在不同的文件中定义同名函数和同名变量,而不必担心命 ...
- HDU 1525 Euclid's Game (博弈)
Euclid's Game Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Tot ...