# Area - POJ 1265（pick定理求格点数+求多边形面积）

1、以格子点为顶点的线段，覆盖的点的个数为GCD(dx,dy)，其中，dxdy分别为线段横向占的点数和纵向占的点数。如果dx或dy为0，则覆盖的点数为dy或dx。
2、Pick公式：平面上以格子点为顶点的简单多边形的面积=边上的点数/2+内部的点数+1。
3、任意一个多边形的面积等于按顺序求相邻两个点与原点组成的向量的叉积之和。

-------------------------------------------------------------------------------------------------------------

```#include<iostream>
#include<string.h>
#include<stdio.h>
#include<algorithm>
#include<math.h>
using namespace std;

const int MAXN = 1e4+7;
const double EPS = 1e-10;

int GCD(int m, int n)
{
if(!m || !n)
return m+n;
return GCD(n, m%n);
}

int main()
{
int T, t=1;

scanf("%d", &T);

while(T--)
{
int N, x, y, nx=0, ny=0, cnt=0, area=0;

scanf("%d", &N);

for(int i=0; i<N; i++)
{
scanf("%d%d", &x, &y);

cnt += GCD(abs(x), abs(y));
x += nx, y += ny;
area += (x*ny - y*nx);
nx = x, ny = y;
}
if(area < 0)area = -area;
printf("Scenario #%d:\n", t++);
printf("%d %d %.1f\n\n", (area-cnt)/2+1, cnt, area/2.0);
}

return 0;
}```

## POJ 1265 Area POJ 2954 Triangle Pick定理

Area Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 5227   Accepted: 2342 Description Being well known for its highly innovative products, Merck would definitely be a good target for industrial espionage. To protect its brand-new resear

## POJ题目1265 Area（PICK定理）

Area Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 5248   Accepted: 2352 Description Being well known for its highly innovative products, Merck would definitely be a good target for industrial espionage. To protect its brand-new resear

## poj 1265 Area（Pick定理）

Area Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 5666   Accepted: 2533 Description Being well known for its highly innovative products, Merck would definitely be a good target for industrial espionage. To protect its brand-new resear