#2009-24:Unique lines

#2009-24:Unique lines


Given a set of points, every pair of points can determine a line. In principle, we can generate N(N-1)/2 lines when there are N points(N < 100). However, it is possible that not all the lines are unique. For example, the three points (0,0), (1,1) and (2,2) give only one unique line. Given a set of points, the task here is to determine the number of unique lines.


The first line is the number of test cases. Each subsequent line is a test case and contains a series of numbers. The first number is the number of points. Each subsequent pair of numbers is the x and y coordinates of a point. You can assume that all the numbers are integers and all the points in a test case are distinct.


For each test case, determine and print out the number of unique lines in a separate line.




你的電子郵件位址並不會被公開。 必要欄位標記為 *