田地丈量 · znzryb
## AC代码
[](https://leetcode.cn/problems/rectangle-area/solutions/472242/223-ju-xing-mian-ji-3xing-dai-ma-by-acw_weian/)
主要思路见此题解
其实说白了就是有个公式可以算x轴投影重叠长度 y轴投影重叠长度 两个相乘就好
[](https://oj.saikr.com/problem/detail/1891/submit)
```cpp
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
ll n;
int main() {
ios::sync_with_stdio(false);
cin.tie(0);cout.tie(0);
ll a,b;
cin>>n>>a>>b;
ll ans=0;
for(ll i=1;i<=n;++i) {
ll c,d,e,f;
cin>>c>>d>>e>>f;
// x 轴上投影 // y 轴上投影
ans+=max(0LL,min(a,e)-max(0LL,c))*max(0LL,min(b,f)-max(0LL,d));
}
cout<<ans<<endl;
return 0;
}
```
## 心路历程(WA,TLE,MLE……)