#define _USE_MATH_DEFINES #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; #define EPS 1e-8 #define INF 1000000 struct Point{ double x,y; Point(){} Point(double _x,double _y){ x=_x; y=_y; } Point operator +(const Point p)const{ return Point(x+p.x,y+p.y); } Point operator -(const Point p)const{ return Point(x-p.x,y-p.y); } Point operator *(const double d)const{ return Point(x*d,y*d); } bool operator <(const Point &p)const{ if(x==p.x) return y>x>>y) return true; return false; } }; struct Line{ Point a,b; Line(){} Line(Point _a,Point _b){ a=_a; b=_b; } bool input(){ if(a.input() && b.input()) return true; return false; } }; struct Circle{ Point c; double r; Circle(){} Circle(Point _c,double _r){ c=_c; r=_r; } }; typedef Point Vector; typedef vector Polygon; typedef Line Segment; double dot(Point p,Point q){ return p.x*q.x+p.y*q.y; } double cross(Point p,Point q){ return p.x*q.y-q.x*p.y; } int ccw(Point a,Point b,Point c){ //a,b,c,は全て異なる Vector v1 = b-a; Vector v2 = c-a; if(cross(v1,v2)>EPS) return +1; //a->b->c が反時計回り if(cross(v1,v2)<-EPS) return -1; //a->b->c が時計回り if(dot(v1,v2)<-EPS) return +2; //cがa-bより後ろ c<-a->b if(v2.norm()-v1.norm()>EPS) return -2; //cがa-bより前 a->b->c return 0; //cがa-b上 a->c->b } Point project(Segment s,Point p){ Vector v1 = s.b-s.a; Vector v2 = p-s.a; double r = dot(v1,v2)/v1.norm(); return s.a+v1*r; } Point reflect(Segment s,Point p){ return p+(project(s,p)-p)*2.0; } bool intersect_ll(Line l,Line m){ return ccw(l.a,l.b,m.a)*ccw(l.a,l.b,m.b)<=0 && ccw(m.a,m.b,l.a)*ccw(m.a,m.b,l.b)<=0; } bool crosspoint_ss(Segment s,Segment t,Point &p){ Vector a1,a2,b1,b2; a1 = s.b-s.a; a2 = t.b-t.a; b1 = t.a-s.a; b2 = s.a-t.b; double s1,s2; s1 = cross(a1,b1)/2; s2 = cross(a1,b2)/2; if(s1+s2b.y) swap(a,b); if(a.y<=EPS && EPSEPS) cnt++; } if((cnt&1)==1) return 2; //内包している return 0; //内包していない } Polygon andrewScan(Polygon s){ if(s.size()<=2) return s; sort(s.begin(),s.end()); Polygon g; for(int i=0;i=2 && ccw(g[n-2],g[n-1],s[i])!=-1; n--){ g.pop_back(); } g.push_back(s[i]); } int upper_n = g.size(); for(int i=s.size()-2;i>=0;i--){ for(int n=g.size(); n>upper_n && ccw(g[n-2],g[n-1],s[i])!=-1; n--){ g.pop_back(); } g.push_back(s[i]); } reverse(g.begin(),g.end()); g.pop_back(); return g; } int N; Line l[100]; int Count(Line m){ int cnt = 0; for(int i = 0; i < N; i++){ if( intersect_ss(l[i], m) ) cnt++; } return cnt; } int main(){ cin >> N; for(int i = 0; i < N; i++) l[i].input(); int ans = 0; vector p; for(int i = 0; i < N; i++){ p.push_back(l[i].a); p.push_back(l[i].b); } for(int i = 0; i < p.size(); i++){ for(int j = i+1; j < p.size(); j++){ ans = max( ans, Count( Line(p[i], p[j]) ) ); } } printf("%d\n", ans); }