1701 交点数


Submit solution

Points: 100
Time limit: 1.0s
Memory limit: 32M

Problem types
Allowed languages
C, C++, Java, Python

Description

二维平面上有许多直线,它们可能会有交点。你的任务就是计算有几个不同的交点。

Input

输入有多组数据,第一行有一个整数T,表示有T组数据。每组数据第一行是一个整数N,表示有N条直线(N<=100)。接下来N行,每行有四个整数x1,y1,x2,y2表示直线上两个不同点的坐标。不存在两条直线重合。

Output

输出T行,每行一个整数,表示不同交点的个数,请注意精度误差。

Sample

Input

2

3
2 6 8 1
0 9 1 8
4 8 1 10

2
6 4 10 10
8 4 10 0

Output

3
1

Source: kokopelli


Comments

There are no comments at the moment.