标签:col span leetcode cout tps tco problem turn int
https://leetcode.com/problems/rectangle-area/discuss/705462/C-36-ms-100-O(1)-15.4-mb-100-O(1)
class Solution { public: int computeArea(int A, int B, int C, int D, int E, int F, int G, int H) { long area1=(C-A)*(D-B),area2=(G-E)*(H-F); if(C<=E||A>=G||B>=H||F>=D) {cout<<"1";return area1+area2;} int w=min(C,G)-max(A,E),h=min(D,H)-max(B,F); return area1+area2-w*h; } };
标签:col span leetcode cout tps tco problem turn int
原文地址:https://www.cnblogs.com/LiuQiujie/p/13193804.html