#include #include #include #include #include #define eps 1e-8 #define inf 999999999 #define N 10100 #define pi acos(-1.0) using namespace std; int Sig(double a) { return a<-eps?-1:a>eps; } struct Point { double x,y; Point(){} Point(double x0,double y0):x(x0),y(y0){} void in() { scanf("%lf%lf",&x,&y); } double len() { return sqrt(x*x+y*y); } double operator ^(Point pt) { return pt.x*x+pt.y*y; } Point operator -(Point pt) { return Point(x-pt.x,y-pt.y); } Point operator +(Point pt) { return Point(x+pt.x,y+pt.y); } Point operator *(double t) { return Point(x*t,y*t); } Point operator /(double t) { return Point(x/t,y/t); } }; struct Polygon { Point p[220]; int n; void in() { for(int i=0;i0) return 1; if(d==0 && Dis(a,po)p[i].y || (p[ind].y==p[i].y && p[ind].x>p[i].x)) ind=i; swap(p[ind],p[0]); po=p[0]; sort(p+1,p+n,cmp); con[0]=0; con[1]=1; cn=1; for(i=2;i0 && Sig(Xmult(p[con[cn-1]],p[con[cn]],p[i]))<=0) cn--; con[++cn]=i; } int tmp=cn; for(i=n-2;i>=0;i--) { while(cn>tmp && Sig(Xmult(p[con[cn-1]],p[con[cn]],p[i]))<=0) cn--; con[++cn]=i;//p[cn]==p[0]; } Point pt[210]; for(int i=0;i=0) tmp.p[tmp.n++]=newp.p[j]; if(r1*r2<0) { Point pp=Intersection(a,b,newp.p[j],newp.p[(j+1)%newp.n]); tmp.p[tmp.n++]=pp; } } newp=tmp; } return Area(newp.p,newp.n); } double Work(Polygon p1,Polygon p2,Point v,double ks,double all) { Polygon tmp; double left=0,right=inf; double mid; while(right-left>eps) { mid=(left+right)*0.5; tmp=p1; for(int i=0;i0) { printf("-1\n"); continue; } printf("%.4f\n",Work(p1,p2,v,k*s,s)); } return 0; }