// In Fact, I did it when I first encountered this problem, but I couldn't find the template with the intersection of line segments, which really left me speechless ..
// Realize the importance of the template ..
/***********************************
The first brute-force attack is enough.
If the two line segments overlap, filter the first line.
Determine the size of the template directly pasted by the intersection of line segments...
***********************************/
# Include <iostream>
# Include <cstdio>
# Include <cstring>
Using namespace STD;
Const int maxn = 100000 + 5;
Const double EPS = 1e-10;
Struct point
{
Double X, Y;
};
Point P [maxn], B [maxn];
Bool ans [maxn];
Double min (double A, double B)
{
Return a <B? A: B;
}
Double max (double A, double B)
{
Return A> B? A: B;
}
Bool inter (point a, point B, point C, point D)
{
If (min (A. X, B. X)> MAX (C. x, D. x) |
Min (A. Y, B. y)> MAX (C. Y, D. Y) |
Min (C. x, D. X)> MAX (A. X, B. x) |
Min (C. Y, D. Y)> MAX (A. Y, B. y ))
Return 0;
Double H, I, J, K;
H = (B. x-a.x) * (C. y-a.y)-(B. y-a.y) * (C. x-a.x );
I = (B. x-a.x) * (D. y-a.y)-(B. y-a.y) * (D. x-a.x );
J = (D. x-c.x) * (A. y-c.y)-(D. y-c.y) * (A. x-c.x );
K = (D. x-c.x) * (B. y-c.y)-(D. y-c.y) * (B. x-c.x );
Return H * I <= EPS & J * k <= EPS;
}
int main ()
{
int N, I, j;
int res [maxn];
while (CIN> N, N)
{
memset (ANS, 0, sizeof (ANS);
for (I = 0; I
{
CIN> P [I]. x> P [I]. y> B [I]. x> B [I]. y;
}
For (I = 0; I <n; I ++)
{
For (j = I + 1; j <n; j ++)
{
If (Inter (P [I], B [I], p [J], B [J])
{
Ans [I] = 1;
Break; // timeout when break is not added...
}
}
}
Int Ct = 0;
Cout <"top sticks :";
For (I = 0; I <n; I ++)
If (! Ans [I])
Res [cT ++] = I + 1;
For (I = 0; I <CT-1; I ++)
Cout <res [I] <",";
Cout <res [CT-1] <"." <Endl;
}
Return 0;
}