1 #include2 #include 3 4 using namespace std; 5 6 struct line 7 { 8 double x1; 9 double y1;10 double x2;11 double y2;12 }l[110];13 14 bool test(int i,int j)15 {16 int s=0;17 double acd = (l[j].x1-l[i].x1)*(l[j].y1-l[j].y2) - (l[j].x1-l[j].x2)*(l[j].y1-l[i].y1);18 double bcd = (l[j].x1-l[i].x2)*(l[j].y1-l[j].y2) - (l[j].x1-l[j].x2)*(l[j].y1-l[i].y2);19 if(acd*bcd<=0)20 s++;21 double abd = (l[i].x1-l[j].x1)*(l[i].y1-l[i].y2) - (l[i].x1-l[i].x2)*(l[i].y1-l[j].y1);22 double abc = (l[i].x1-l[j].x2)*(l[i].y1-l[i].y2) - (l[i].x1-l[i].x2)*(l[i].y1-l[j].y2);23 if(abd*abc<=0)24 s++;25 if(s==2)26 return true;27 return false;28 }29 30 int main()31 {32 int n;33 while(scanf("%d",&n)!=EOF)34 {35 if(n==0)36 break;37 for(int i=0;i