题目描述
Given the coordinates of the endpoints(p1-q1 and p2-q2) of the two line-segments. Check if they intersect or not.
Example 1:
Input:
p1=(1,1)
q1=(10,1)
p2=(1,2)
q2=(10,2)
Output:
0
Explanation:
The two line segments formed
by p1-q1 and p2-q2 do not intersect.
Example 2:
Input:
p1=(10,0)
q1=(0,10)
p2=(0,0)
q2=(10,10)
Output:
1
Explanation:
The two line segments formed
by p1-q1 and p2-q2 intersect.
Your Task:
You don't need to read input or print anything. Your task is to complete the function doIntersect() which takes the four points as input parameters and returns 1 if the line segments intersect. Otherwise, it returns 0.
Expected Time Complexity:O(1)
Expected Auxillary Space:O(1)
Constraints:
-10^{6}<=X,Y(for all points)<=10^{6}
输入格式
见题面
输出格式
见题面