#include <iostream>
#define LL long long
using namespace std;
int main()
{
LL x1,y1,x2,y2,x3,y3,x4,y4;
cin>>x1>>y1>>x2>>y2>>x3>>y3>>x4>>y4;
LL s1,s2,s;
s1=(x2-x1)*(y2-y1);
s2=(x4-x3)*(y4-y3);
LL a1=max(min(x1,x2),min(x3,x4));//左边大的
LL a2=min(max(x1,x2),max(x3,x4));//右边小的
LL a3=max(min(y1,y2),min(y3,y4));
LL a4=min(max(y1,y2),max(y3,y4));
s=s1+s2-(a2-a1)*(a4-a3);
if(a1<a2&&a3<a4)
cout<<s;
else
cout<<s1+s2;
// 请在此输入您的代码
return 0;
}
标签:3.19,y2,min,max,LL,蓝桥,y1,y3,矩形
From: https://blog.csdn.net/2301_76518242/article/details/136972357