Pro.ID22161 TitleTriangle Calculating Title链接http://10.20.2.8/oj/exercise/problem?problem_id=22161 AC0 Submit0 Ratio- 时间&空间限制描述ZZZ is an idle boy, once he scribbled aimlessly on a very large blank paper. He randomly drew a number of lines. Suddenly he was so curious to calculate the number of triangles in his picture. ZZZ had totally drawn N lines. Figure 1 shows sample lines. You could regard them as beelines. So each line can be represented by the equation Ax + By + C = 0. Figure 1 Sample lines ZZZ wanted to count the number of unique triangles resulting from the intersection. Two triangles are considered to be different if and only if they share at most two common vertices. Notice that no two lines ZZZ drew is overlap. 输入The first line of input there is one integer T ( T ≤ 50 ), giving the number of test cases in the input. For each test case, there is a line containing a number N ( 1 ≤ N ≤ 1000 ). Then followed by N lines, the i-th line has 3 integer Ai, Bi, Ci ( |Ai|, |Bi|, |Ci| ≤ 10000 ), which are the coefficients of equation of the i-th beeline. 输出Description ZZZ is an idle boy, once he scribbled aimlessly on a very large blank paper. He randomly drew a number of lines. Suddenly he was so curious to calculate the number of triangles in his picture. ZZZ had totally drawn N lines. Figure 1 shows sample lines. You could regard them as beelines. So each line can be represented by the equation Ax + By + C = 0. Figure 1 Sample lines ZZZ wanted to count the number of unique triangles resulting from the intersection. Two triangles are considered to be different if and only if they share at most two common vertices. Notice that no two lines ZZZ drew is overlap. Input The first line of input there is one integer T ( T ≤ 50 ), giving the number of test cases in the input. For each test case, there is a line containing a number N ( 1 ≤ N ≤ 1000 ). Then followed by N lines, the i-th line has 3 integer Ai, Bi, Ci ( |Ai|, |Bi|, |Ci| ≤ 10000 ), which are the coefficients of equation of the i-th beeline. Output For each test case, output one line with the number of unique triangles. Sample Input 1 Sample Output 4 Source 样例输入1 样例输出4 作者 |