2016武汉科技大学邀请赛现场赛 G题

来源:互联网 发布:火车票选铺位软件 编辑:程序博客网 时间:2024/04/30 15:50

Plane

Time Limit: 1 Sec  Memory Limit: 128 MB   64bit IO Format: %lld
Submitted: 43  Accepted: 7
[Submit][Status][Web Board]

Description

Cheng is an engineer. Now, Cheng is working on a two dimensional plane.
He knows that every line on a plane can be clearly defined by three coefficients A,B and C: any point (x,y) lies on the line if and only if

Ax+By+C=0

Let's call a set of lines to be perfect if there does not exist a point that belongs to two or more distinct lines of the set.
He has a set of lines on a plane and he wants to find out the size of the largest perfect subset of this set.

Input

The first line of input contains the number of test caseT(T<=20) . The descriptions of the test cases follow:
Each test case consists of one integer N, denoting number of lines.
Next N(N<=1e5) lines contain 3 space-separated integers each denoting coefficients A,B and C  respectively (|A|,|B|,|C|<=1e9).
 

Output

For each test case output the size of the largest perfect subset in a single line. 

Sample Input

151 1 12 2 21 1 210 20 300 5 2

Sample Output

2题意:n条个点最多能确定几条直线。还没想通怎么解决的,先给出官方的题解题解:通过斜率进行排序,然后除掉gcd,注意坑点。
0 0
原创粉丝点击