#include #include #include #include using namespace std; const double inf=1e100,EPS=1e-6; const int N=5; double cr0,cr1; int n,s,j,bx[2],by[2],init; struct xy { int x,y; } v[N],d[N],e[2]; //WA double 判断正负要用 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; } int same(double x0,double y0,double x3,double y3,double x1,double y1,double x2,double y2) { double x=x3-x0,y=y3-y0;//y0->x0 int a=sign(cross(x,y,x1-x0,y1-y0)),b=sign(cross(x,y,x2-x0,y2-y0)); //WA*N 两条线段是在同一直线上的但是没有重合部分,那么通过跨立实验返回的是相交,就错了,必须再加上快速排斥 if(a==0&&b==0) { if(max(x0,x3)max(x1,x2)||max(y0,y3)max(y1,y2)) { return 1; } } if(a<0&&b<0) { return 2; } return a*b; } int main() { scanf("%d",&n); while(n--) { for(int i=0; i<2; i++) { scanf("%d%d",&e[i].x,&e[i].y);//&又忘了 } for(int i=0; i<2; i++) { scanf("%d%d",&bx[i],&by[i]); } for(int i=1; i