两个条件
1.两个向量叉积为0;
2.点在线段端点矩形区域内;
#include <iostream>
#include <bits/stdc++.h>
using namespace std;
struct point{
double x;
double y;
};
bool onsegement(point pi,point pj,point q){
if((q.x-pi.x)*(pj.y-pi.y)==(pj.x-pi.x)*(q.y-pi.y)&&min(pi.x,pj.x)<=q.x&&q.x<=max(pi.x,pj.x)&&min(pi.y,pj.y)<=q.y&&q.y<=max(pi.y,pj.y)) return true;
return false;
}
int main()
{
point q,a,b;
cin>>q.x>>q.y>>a.x>>a.y>>b.x>>b.y;
if(onsegement(a,b,q)==true) printf("YES
");
else printf("NO
");
return 0;
}