class Solution {
public:
int computeArea(int A, int B, int C, int D, int E, int F, int G, int H)
{
int sum = (C - A) * (D - B) + (G - E) * (H - F);
int A1 = max(A, E), B1 = max(B, F), C1 = min(C, G), D1 = min(D, H);
if (D1 <= B1 || C1 <= A1) return sum;
return sum - (D1 - B1) * (C1 - A1);
}
};
Rectangle Area
最新推荐文章于 2019-04-19 11:56:53 发布