题意:给定一个大矩形,再给定在一个小矩形,然后给定一个新矩形的长和高,问你能不能把这个新矩形放到大矩形里,并且不与小矩形相交。

析:直接判定小矩形的上下左右四个方向,能不能即可。

代码如下:

  1. #pragma comment(linker, "/STACK:1024000000,1024000000")
  2. #include <cstdio>
  3. #include <string>
  4. #include <cstdlib>
  5. #include <cmath>
  6. #include <iostream>
  7. #include <cstring>
  8. #include <set>
  9. #include <queue>
  10. #include <algorithm>
  11. #include <vector>
  12. #include <map>
  13. #include <cctype>
  14. #include <cmath>
  15. #include <stack>
  16. #define debug puts("+++++")
  17. //#include <tr1/unordered_map>
  18. #define freopenr freopen("in.txt", "r", stdin)
  19. #define freopenw freopen("out.txt", "w", stdout)
  20. using namespace std;
  21. //using namespace std :: tr1;
  22.  
  23. typedef long long LL;
  24. typedef pair<int, int> P;
  25. const int INF = 0x3f3f3f3f;
  26. const double inf = 0x3f3f3f3f3f3f;
  27. const LL LNF = 0x3f3f3f3f3f3f;
  28. const double PI = acos(-1.0);
  29. const double eps = 1e-8;
  30. const int maxn = 50000 + 5;
  31. const LL mod = 1e3 + 7;
  32. const int N = 1e6 + 5;
  33. const int dr[] = {-1, 0, 1, 0, 1, 1, -1, -1};
  34. const int dc[] = {0, 1, 0, -1, 1, -1, 1, -1};
  35. const char *Hex[] = {"0000", "0001", "0010", "0011", "0100", "0101", "0110", "0111", "1000", "1001", "1010", "1011", "1100", "1101", "1110", "1111"};
  36. inline LL gcd(LL a, LL b){ return b == 0 ? a : gcd(b, a%b); }
  37. inline int gcd(int a, int b){ return b == 0 ? a : gcd(b, a%b); }
  38. inline int lcm(int a, int b){ return a * b / gcd(a, b); }
  39. int n, m;
  40. const int mon[] = {0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
  41. const int monn[] = {0, 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
  42. inline int Min(int a, int b){ return a < b ? a : b; }
  43. inline int Max(int a, int b){ return a > b ? a : b; }
  44. inline LL Min(LL a, LL b){ return a < b ? a : b; }
  45. inline LL Max(LL a, LL b){ return a > b ? a : b; }
  46. inline bool is_in(int r, int c){
  47. return r >= 0 && r < n && c >= 0 && c < m;
  48. }
  49.  
  50. int main(){
  51. freopen("grave.in", "r", stdin);
  52. freopen("grave.out", "w", stdout);
  53. int x1, y1, x2, y2, x3, y3, w, h, x4, y4;
  54. while(cin >> x1 >> y1 >> x2 >> y2){
  55. cin >> x3 >> y3 >> x4 >> y4;
  56. cin >> w >> h;
  57. bool ok = false;
  58. if(y2 - y4 >= h && x2 - x1 >= w) ok = true;
  59. else if(y3 - y1 >= h && x2 - x1 >= w) ok = true;
  60. else if(x3 - x1 >= w && y2 - y1 >= h) ok = true;
  61. else if(x2 - x4 >= w && y2 - y1 >= h) ok = true;
  62. printf("%s\n", ok ? "Yes" : "No");
  63. }
  64. return 0;
  65. }

Gym 100531G Grave(水题)的更多相关文章

  1. Codeforces Gym 100531G Grave 水题

    Problem G. Grave 题目连接: http://codeforces.com/gym/100531/attachments Description Gerard develops a Ha ...

  2. UVaLive 6591 && Gym 100299L Bus (水题)

    题意:略. 析:不解释,水题. 代码如下: #pragma comment(linker, "/STACK:1024000000,1024000000") #include < ...

  3. Codeforces Gym 100286I iSharp 水题

    Problem I. iSharpTime Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://acm.hust.edu.cn/vjudge/contest/ ...

  4. CodeForces Gym 100685C Cinderella (水题)

    题意:给定 n 个杯子,里面有不同体积的水,然后问你要把所有的杯子的水的体积都一样,至少要倒少多少个杯子. 析:既然最后都一样,那么先求平均数然后再数一下,哪个杯子的开始的体积就大于平均数,这是一定要 ...

  5. Two Operations Gym - 102263M 优先队列水题

    Two Operations Gym - 102263M Ayoub has a string SS consists of only lower case Latin letters, and he ...

  6. codeforces Gym 100187L L. Ministry of Truth 水题

    L. Ministry of Truth Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/gym/100187/p ...

  7. 水题 Gym 100553K Knockout Racing

    题目传送门 /* 题意:有若干个点在一个区间内来回移动,1m/s. 水题:n^2的复杂度能解决,注意时间可能大于一个周期,要取模 */ #include <cstdio> #include ...

  8. Codeforces Gym 100286G Giant Screen 水题

    Problem G.Giant ScreenTime Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://acm.hust.edu.cn/vjudge/con ...

  9. 每日一刷(2018多校水题+2016icpc水题)

    11.9 线段树 http://acm.hdu.edu.cn/showproblem.php?pid=6315 求逆序对个数 http://acm.hdu.edu.cn/showproblem.php ...

随机推荐

  1. 12.3——类作用域,构造函数,友元,static类成员

    类作用域: (1)成员函数在类外定义时,因为函数体还有形参列表都出现在成员名之后,都是在类作用域内定义,所以不用加域作用符 来引用其他的成员. (2)函数的返回值不一定需要在类的作用域中,但是若是返回 ...

  2. free delete malloc new(——高品质量程序设计指南第16章)

    free和delete只是把指针所指向的内存给释放掉了,但是指针本身并没有被删掉. 所以在释放掉内存后一定要记得将指针指向NULL ,动态内存分配不会自动的释放,一定要记得free掉

  3. 寒武纪camp Day2

    补题进度:8/10 A(计数+BIT) 题意: 给一个长度为n的数组a[],任意选0<=i<=j<n,将a[i]~a[j]从小到大排序,形成新的数组.问有多少个不同的新数组. N,a ...

  4. zookeeper原理浅析(二)

    参考:https://www.cnblogs.com/leocook/p/zk_1.html 代码:https://github.com/littlecarzz/zookeeper 1. 数据模型 1 ...

  5. mysql查看存储过程show procedure status;

    1.mysql查看存储过程(函数) 2.MySQL查看触发器 查看触发器 语法:SHOW TRIGGERS [FROM db_name] [LIKE expr] 实例:SHOW TRIGGERS\G ...

  6. 搜索引擎keyword智能提示的一种实现

    问题背景 搜索关键字智能提示是一个搜索应用的标配.主要作用是避免用户输入错误的搜索词,并将用户引导到相应的关键词上,以提升用户搜索体验. 美团CRM系统中存在数以百万计的商家,为了让用户高速查找到目标 ...

  7. 【转】AOP

    原文:http://blog.csdn.net/zhoudaxia/article/details/38502347 .---------------------------------------- ...

  8. Registration system

    Registration system 时间限制:1000 ms  |  内存限制:65535 KB 难度:2 描写叙述 A new e-mail service "Berlandesk&q ...

  9. win8 metro 自己写摄像头录像项目

    这是要求不适用CameraCaptureUI等使用系统自带的 camera  UI界面.要求我们自己写调用摄像头摄像的方法,如今我把我的程序贴下: UI界面的程序: <Page x:Class= ...

  10. webservice0基础

    在学习webservice的时候,常常将ns和url花了好久时间才理解过来,这里备份下. 首先定义接口: @WebService public interface IService { @WebRes ...