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 秒时间,还每秒速度最多变化多少,让你求最长距离. 析:其实这个题很水的,看一遍就知道怎么做了,很明显就是先从末速度开始算起,然后倒着推. 代 ...
随机推荐
- nsDATA 转结构体
很多时候需要将c,c++形式的struct转换为 NSData来处理.但是怎么转换呢? 假设有这么一个结构体: struct MYINFO { int a; long b; char c ...
- OpenERP 7.0 中文报表PDF乱码(WindowsXP)
OpenERP默认安装输出的PDF中文报表都是一些方块: 此问题可以通过oecn_base_fonts模块解决: 更多关于oecn_base_fonts的信息请参考: 1. OpenERPv7.0 中 ...
- Asp.Net 自定义控件实现图片的上传,浏览,删除功能
4月的时候公司比较闲,就想着自己做点东西,其实主要是为了更加熟悉.Net,毕竟接触的时间不长,趁着有时间想提高提高.不过当我做到图片上传这个功能的时候,就有些停滞不前了,连续写了两天也达不到自己想要的 ...
- MATLAB Coder从MATLAB生成C/C++代码步骤
MATLAB Coder可以从MATLAB代码生成独立的.可读性强.可移植的C/C++代码. 使用MATLAB Coder产生代码的3个步骤: 准备用于产生代码的MATLAB算法: 检查MATLAB代 ...
- Delphi中BitBlt函数实现屏幕对象抓图
uses WinTypes, WinProcs, Forms, Controls, Classes, Graphics; function CaptureScreenRect( ARect: TRec ...
- PHPCMS V9实现硬件地址MAC绑定访问技术实现
目的:会员登录需要 用户名.密码.身份识别码(新增字段) 效果: 解决方法: 目前数据库中macaddress字段已经添加,修改了phpcms\modules\member\index.php 63 ...
- 第二百三十一天 how can I 坚持
哎,蛋疼的一天,一点破问题搞了一下午,还没搞利索. 他们要组织出去玩,我没有参加啊,随便找了个借口. 博客园的字体怎么变小了呢,看着好难受啊,昨天传照片传的? 睡觉.外边下着雨呢,喜欢下雨的夏天还有下 ...
- Linux操作系统时间与BIOS硬件时间
注:以Ubuntu为例说明 在Linux计算机上,有两个时间,一个是硬件时间(BIOS中记录的时间,称为hwclock),另一个是操作系统时间(osclock).硬件时钟由BIOS电池供电, 当计算机 ...
- HDU 5858 Hard problem (数学推导)
Hard problem 题目链接: http://acm.split.hdu.edu.cn/showproblem.php?pid=5858 Description cjj is fun with ...
- vim插件开发初步
[vim插件开发初步] 将如下代码存在helloworld.vim, 放在~/.vim/plugin目录下,插件即可生效.:w保存代码后, 用:source命令执行后,也可以使用Helloworld命 ...