[没人气,抄道题] 矩形面积
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.
求两个矩形组成的总面积,每个矩形给出了左下角坐标和右上角坐标。
如图,左边矩形的面积是 24,右边矩形的面积是 27,两矩形的交集面积是 6,所以总面积是 24+27-6=45
int computeArea(int A, int B, int C, int D, int E, int F, int G, int H) {
// 代码
}