#include <iostream>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <cstdlib>
#include <queue>
#include <stack>
#include <algorithm>
#define W(a) while((a)--)
#define Si(a) scanf("%d", &a)
#define Sl(a) scanf("%lld", &a)
#define Pi(a) printf("%d\n", (a))
#define Pl(a) printf("%lld\n", (a))
#define CLR(a, b) memset(a, (b), sizeof(a))
#define INF 0x3f3f3f3f
#define LL long long
using namespace std;
int main()
{
int n;
while(Si(n)==1)
{
int maxx = -INF, maxy = -INF;
int minx = INF, miny = INF;
int x, y;
for(int i = 0; i < n; ++i)
{
scanf("%d%d", &x, &y);
maxx = max(maxx, x);
minx = min(minx, x);
maxy = max(maxy, y);
miny = min(miny, y);
}
LL s;
s = (maxx-minx)*(maxy-miny);
if(s==0) s = -1;
Pl(s);
}
return 0;
}
本博客探讨了如何通过仅保留的四个矩形游泳池顶点来精确计算原始游泳池的面积,展示了数学几何原理在实际问题解决中的应用。
2065

被折叠的 条评论
为什么被折叠?



