题意:构造凸包,并求多边形面积. 附代码: #include <iostream> #include <cstdio> #include <cmath> #include <algorithm> using namespace std; int n; const double eps = 1e-6; struct Point { int x,y; }S[10010],map[10010]; int direction(Point p0,Point p1, Point p2) { return (p1.x - p0.x)*(p2.y - p0.y) - (p2.x - p0.x)*(p1.y - p0.y); } double dist(Point p1, Point p2) { return sqrt((double)((p2.x - p1.x)*(p2.x - p1.x) + (p2.y - p1.y)*(p2.y - p1.y))); } int cmp(Point p1, Point p2) { if(direction(map[0],p1,p2) > 0) return 1; else if(direction(map[0],p1,p2) == 0 && dist(map[0],p1) - dist(map[0],p2) < 0) return 1; return 0; } int Graham() { int i,tmp = 0; for(i = 1; i < n; i++) if(map[i].y < map[tmp].y || (map[i].y == map[tmp].y && map[i].x < map[tmp].x)) tmp = i; Point p = map[tmp]; map[tmp] = map[0]; map[0] = p; sort(map + 1,map + n,cmp); int top = 2; S[0] = map[0]; S[1] = map[1]; S[2] = map[2]; for(i = 3; i < n; i++) { while(direction(S[top-1],S[top],map[i]) < eps) top--; S[++top] = map[i]; } return ++top; } double mul(int n) { double sum = 0.0; int i; for(i=0; i<n; i++) sum += S[(i+1)%n].y*(S[i].x-S[(i+2)%n].x); return fabs(sum); } int main(void) { int num; while(scanf("%d",&n)!=EOF) { int i; double ans = 0.0; for(i = 0; i < n; i++) scanf("%d%d",&map[i].x,&map[i].y); num = Graham(); ans = mul(num); ans /= 2; printf("%.0lf/n",floor(ans/50.0)); } return 0; }