22161_TriangleCalculating

2022-5-16 18:21| 发布者: Hocassian| 查看: 20| 评论: 0|原作者: 肇庆学院ACM合集

摘要:
C:\Users\Administrator\Downloads\2019-10-12-10-14-5-89506163363100-Problem List-采集的数据-后羿采集器.html

Pro.ID

22161

Title

Triangle Calculating

Title链接

http://10.20.2.8/oj/exercise/problem?problem_id=22161

AC

0

Submit

0

Ratio

-

时间&空间限制

  • Time Limit: 2000/1000 MS (Java/Others)     Memory Limit: 65536/65536 K (Java/Others)
  • 描述

    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
    6
    1 -1 0
    1 0 -1
    1 0 -2
    1 0 -3
    0 1 -1
    0 1 -3

    Sample Output

    4

    Source

    样例输入

    1
    6
    1 -1 0
    1 0 -1
    1 0 -2
    1 0 -3
    0 1 -1
    0 1 -3

    样例输出

    4

    作者


    路过

    雷人

    握手

    鲜花

    鸡蛋

    最新评论

    返回顶部