Overlapping rectangles判断两个矩形是否重叠的问题 C++
Given two rectangles, find if the given two rectangles overlap or not.
A rectangle is denoted by providing the x and y co-ordinates of two points: the left top corner and the right bottom corner of the rectangle.
Note that two rectangles sharing a side are considered overlapping.
Input:
The first integer T denotes the number of test cases. For every test case, there are 2 lines of input. The first line consists of 4 integers: denoting the co-ordinates of the 2 points of the first rectangle. The first integer denotes the x co-ordinate and the second integer denotes the y co-ordinate of the left topmost corner of the first rectangle. The next two integers are the x and y co-ordinates of right bottom corner. Similarly, the second line denotes the cordinates of the two points of the second rectangle.
Output:
For each test case, output (either 1 or 0) denoting whether the 2 rectangles are overlapping. 1 denotes the rectangles overlap whereas 0 denotes the rectangles do not overlap.
Constraints:
1 <= T <= 10
-10000 <= x,y <= 10000
T denotes the number of test cases. x denotes the x co-ordinate and y denotes the y co-ordinate.
Example:
Input: - - Output:
下面是我的代码实现:
最新文章
- Laravel与Repository Pattern(仓库模式)
- 用AXIS2发布WebService的方法
- 一个关于C#中基类与接口混合继承的疑问总结
- iOS语音合成
- vijosP1371 方程的解
- SQL rank() 用法
- How to Validate XML using Java
- HDU 4288 线段树+离散化
- Spring Boot 集成 Hystrix
- iOS开发多线程之GCD
- 支付-stripe
- L3-020 至多删三个字符 (30 分)(DP)
- Nginx 日志文件 access_log 详解
- 关于redis集群的问题no reachable node in cluster
- excel随机函数
- Spark学习笔记——在集群上运行Spark
- 【Web】移动端下拉刷新、上拉加载更多插件
- PHP获取数组中奇偶数
- 「TJOI 2018」游园会 Party
- mybatis源码分析(3)-----SqlSessionHolder作用