#K33997. Collinearity Check
Collinearity Check
Collinearity Check
Given coordinates of three points in a 2D plane, determine whether these points are collinear. Three points are said to be collinear if the area of the triangle formed by them is zero. The area of the triangle can be computed using the formula:
$$\text{Area} = \frac{1}{2}\left|x_1(y_2-y_3) + x_2(y_3-y_1) + x_3(y_1-y_2)\right|$$
For the purpose of this problem, you do not need to consider the \(\frac{1}{2}\) factor: simply check whether the expression inside the absolute value is zero. If it is, then the points are collinear; otherwise, they are not.
inputFormat
The input consists of a single line with six integer numbers: x1 y1 x2 y2 x3 y3
, representing the coordinates of the three points in the 2D plane.
outputFormat
Output True
if the three points are collinear, and False
otherwise.
1 2 2 4 3 6
True