//枚举过每一条线段的直线, //再判断其他线段的点在直线上或被直线穿过 //即求直线与线段相交(叉积) #include<stdio.h> #include<math.h> #define esp 1e-8 struct Node { double x,y; } a[105],b[105],c[210],tmp1,tmp2; double cal(Node a,Node b,Node c)//ca*cb { return ((a.x-c.x)*(b.y-c.y)-(b.x-c.x)*(a.y-c.y)); } double diji(Node a,Node b,Node c)//ab·ac { return (b.x-a.x)*(c.x-a.x)+(b.y-a.y)*(c.y-a.y); } int main() { int _case,i,j,k,n; scanf("%d",&_case); while(_case--) { scanf("%d",&n); for(i=0; i<n; i++) { scanf("%lf%lf",&a[i].x,&a[i].y); c[2*i]=a[i]; scanf("%lf%lf",&b[i].x,&b[i].y); c[2*i+1]=b[i]; } for(i=0; i<2*n; i++) { tmp1=c[i]; for(k=i+1; k<2*n; k++) { tmp2=c[k]; if(fabs(tmp1.x-tmp2.x)<esp&&fabs(tmp1.y-tmp2.y)<esp)continue;//判断重点 //printf("%d# ",i); for(j=0; j<n; j++) { double k=cal(a[j],tmp2,tmp1)*cal(b[j],tmp2,tmp1); if(k>esp)break; } if(j==n)break; } if(j==n)break; } if(j!=n)printf("No! "); else printf("Yes! "); } return 0; }