Problem 270 -- Lining Up
Tips
I wrote a function that inputs 3 points (six coordinates) and check whether the points are on a straight line.
The main program call this function repeatively to check combinations of points, meanwhile I record the counts of points-on-a-straight-line.
Note that if we have checked point 1-2-3, it is not necessary to check point 1-3-2 or 2-3-1, etc. Eliminate as much unnecessary checking as possible.
If there is no three points on a straight line, the minimum output should be 2, not 0, because any two points can form a straight line.
Be careful this problem's input is in 'multiple input format'.
Input
2 1 1 2 2 3 3 4 4 10 10 8 8 9 10 10 11 10 3 30 18 6 0 0 0 2 -3
Output
6 4