解题思路:
注意事项:
参考代码:
x1,y1,x2,y2,x3,y3,x4,y4=map(int,input().split())
s1=(x2-x1)*(y2-y1)+(x4-x3)*(y4-y3)
x_left = max(x1, x3) #交集面积
y_left = max(y1, y3)
x_right = min(x2, x4)
y_right = min(y2, y4)
if x_left < x_right and y_left < y_right:
s2 = (x_left - x_right) * (y_left - y_right) #交集面积大小
else:
s2=0
s=s1-s2
print(s)
0.0分
0 人评分