Skip to content

Latest commit

 

History

History
36 lines (28 loc) · 614 Bytes

223.md

File metadata and controls

36 lines (28 loc) · 614 Bytes

223. Rectangle Area

Description

link


Solution

无力吐槽这题。。。


Code

class Solution:
    def computeArea(self, A, B, C, D, E, F, G, H):
        """
        :type A: int
        :type B: int
        :type C: int
        :type D: int
        :type E: int
        :type F: int
        :type G: int
        :type H: int
        :rtype: int
        """
        le = max(A,E)
        ri = max(min(C,G),le)
        bt = max(B,F)
        tp = max(min(D,H),bt)
        return (C-A)*(D-B)+(G-E)*(H-F)-(ri-le)*(tp-bt)