题目链接:http://poj.org/problem?id=3348
思路:模板题,求面积就是以p0为统一端点,转换成求一些三角形的面积和。
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <bitset>
#include <cmath>
#include <cctype>
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <queue>
#include <map>
#include <set>
#include <sstream>
#include <iomanip>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
const ll inff = 0x3f3f3f3f3f3f3f3f;
#define FOR(i,a,b) for(int i(a);i<=(b);++i)
#define FOL(i,a,b) for(int i(a);i>=(b);--i)
#define REW(a,b) memset(a,b,sizeof(a))
#define inf int(0x3f3f3f3f)
#define si(a) scanf("%d",&a)
#define sl(a) scanf("%lld",&a)
#define sd(a) scanf("%lf",&a)
#define ss(a) scanf("%s",a)
#define mod int(1e9+7)
#define pb push_back
#define Pll pair<ll,ll>
#define P pair<int,int>
#define pi acos(-1)
#define eps 1e-8
int n,top,m,cnt;
double x,y;
const int N=1008;
struct point
{
double x,y;
point(){}
point(double a,double b):x(a),y(b){}
point operator-(point a){
return point(x-a.x,y-a.y);
}
point operator+(point a){
return point(x+a.x,y+a.y);
}
double operator*(point a){
return x*a.y-y*a.x;
}
bool operator<(const point a) const{
if(fabs(x-a.x)<eps) return y<a.y;
return x<a.x;
}
double len(){
return sqrt(x*x+y*y);
}
}a[N],p[N];
double cj(point a,point b,point c) {return (a-c)*(b-c);}
void graham()
{
sort(a+1,a+cnt+1);
p[1]=a[1],p[2]=a[2],top=2;
for(int i=3;i<=cnt;i++)
{
while(top>1&&cj(a[i],p[top],p[top-1])>=0) top--;
p[++top]=a[i];
}
m=top;
p[++top]=a[cnt-1];
for(int i=cnt-2;i>=1;i--)
{
while(top>m&&cj(a[i],p[top],p[top-1])>=0) top--;
p[++top]=a[i];
}
}
int main()
{
cin.tie(0);
cout.tie(0);
si(n);
FOR(i,1,n) sd(a[i].x),sd(a[i].y);
sort(a+1,a+n+1);
cnt=1;
FOR(i,2,n)
{
if(fabs(a[i].x-a[cnt].x)>eps||fabs(a[i].y-a[cnt].y)>eps) a[++cnt]=a[i];
}
graham();
double ans=0.0;
int s;
FOR(i,2,top-1) ans+=cj(p[i],p[i+1],p[1]);
ans/=100.0;
s=(int)ans;
cout<<s<<endl;
return 0;
}