#include//POJ_2653_Pick-up sticks_線線相交#include #define EPS 1e-9struct point{ double x,y;};struct Line{ point p1,p2;}line[100002];double MAX(double a,double b){ return a>b?a:b;}double MIN(double a,double b){ return a>b?b:a;}double mulit(point p0,point p1,point p2){ return (p1.x-p0.x)*(p2.y-p0.y)-(p2.x-p0.x)*(p1.y-p0.y);}int cross(Line a,Line b){//判断两线段是否相交 if(MAX(a.p1.x,a.p2.x)>MIN(b.p1.x,b.p2.x)&& MAX(b.p1.x,b.p2.x)>MIN(a.p1.x,a.p2.x)&& MAX(a.p1.y,a.p2.y)>MIN(b.p1.y,b.p2.y)&& MAX(b.p1.y,b.p2.y)>MIN(a.p1.y,a.p2.y)&& mulit(a.p1,a.p2,b.p1)*mulit(a.p1,a.p2,b.p2)