Rectangle Area 两个矩形的面积
来源:互联网 发布:平板电脑软件助手 编辑:程序博客网 时间:2024/05/16 07:03
Rectangle Area
Find the total area covered by two rectilinear rectangles in a 2D plane.
Each rectangle is defined by its bottom left corner and top right corner as shown in the figure.
Assume that the total area is never beyond the maximum possible value of int.
class Solution {public: int computeArea(int A, int B, int C, int D, int E, int F, int G, int H) { int res=(C-A)*(D-B)+(G-E)*(H-F); int x1,y1,x2,y2; x1=A>E?A:E; y1=B>F?B:F; x2=C<G?C:G; y2=D<H?D:H; if(x1>=x2 || y1>= y2) return res; return res-(x2-x1)*(y2-y1); }};
0 0
- Rectangle Area 两个矩形的面积
- Rectangle Area 两个矩形的面积
- leetcode_223. Rectangle Area 求两个矩形覆盖的面积之和
- LeetCode 223. Rectangle Area(两个矩形的复合面积计算)
- Leetcode 223 Rectangle Area 矩形区域面积
- LeetCode 223 Rectangle Area(矩形面积)
- Rectangle Area-带有交差集矩形面积
- leetcode 223. Rectangle Area-矩形面积
- leetcode 223. Rectangle Area 矩形面积计算
- 223. Rectangle Area (求两矩形重合部分的面积)
- LeetCode-223. Rectangle Area (JAVA)求矩形覆盖面积
- Maximal Rectangle 最大的矩形面积
- (LeetCode)Rectangle Area --- 求图形覆盖的面积
- Largest Rectangle in Histogram 直方图中最大的矩形面积
- Largest Rectangle in Histogram 一排矩形中的最大的面积
- 用Rectangle输出一个矩形的周长和面积
- 1.创建一个Rectangle类,添加width和height两个成员变量。 2.在Rectangle中添加两种方法分别计算矩形的周长和面积 3.编程利用Rectangle输出一个矩形的周
- 1.创建一个Rectangle类,添加width和height两个成员变量。 2.在Rectangle中添加两种方法分别计算矩形的周长和面积 3.编程利用Rectangle输出一个矩形的周
- sqlservice 事物 以及acid原则,隔离级别,脏读,幻读,不可重复读等
- Java自动化测试之测试常用功能集集锦(UiAutomator、Selenium等)
- jfinal与bootstrap的登录跳转实战
- visual studio 2010 添加数据库连接 测试连接通过 报错:关键字不在数据字典中
- 随机函数Random()生成验证码
- Rectangle Area 两个矩形的面积
- 长沙河西网劲爆上线 引领长沙河西人网络新生活
- Web服务器的常见端口
- IOS9 未受信任的企业级开发者 没有信任按钮 解决
- TC 668 #DIV2
- windows下socket编程:区分shutdown()及closesocket()
- Contains Duplicate 重复数的判断
- NameNode 接收请求
- 正则表达式的学习及示例