//参考别人的 #include #include #include #include #include using namespace std; const double pi=acos(-1.00),eps = 1e-8;//pi3.14~ const int N=1005,inf=0x3f3f3f3f; double ans=0; int q[N],n; struct Point{ double x,y; Point () {}//无参的构造函数,及初始化、赋初值 Point (double xx,double yy) :x(xx),y(yy) {} Point friend operator - (Point a,Point b) { return Point(a.x-b.x,a.y-b.y); } double friend operator ^ (Point a,Point b) { return a.x*b.y-a.y*b.x; } bool friend operator < (Point a,Point b) { if(a.y==b.y ) return a.xs; int sign(double d) { if(fabs(d)0? 1:-1; } //double cross(double x1, double y1, double x2, double y2) //{ // return x1 * y2 - x2 * y1; //} double dist(Point a,Point b) { Point c=a-b; return sqrt(c.x*c.x+c.y*c.y);//CE double } bool cmp(Point a,Point b) { int s=sign((a-p[1])^(b-p[1])); if(s>0||(s==0&&dist(a,p[1])1&&sign((p[q[top]]-p[q[top-1]])^(p[i]-p[q[top]]))<=0){ top--; } q[++top]=i; } double res=0; for(int i=1;i