题库练习 Ruminations on Ruminants
← 上一题 下一题 →

A10112 | Ruminations on Ruminants

时间限制1s
内存限制256MB
通过 / 提交0/0

题目描述

Kevin Sun is ruminating on the origin of cows while standing at the origin of the Cartesian plane. He notices $n$ lines ![](/uploads/acgo/image/36404d3e3555832f_8e11606f9c65.jpeg) on the plane, each representable by an equation of the form $ax+by=c$ . He also observes that no two lines are parallel and that no three lines pass through the same point.

For each triple $(i,j,k)$ such that $1<=i<j<k<=n$ , Kevin considers the triangle formed by the three lines ![](/uploads/acgo/image/599c0c1244ee9a34_2ed28715cb47.jpeg) . He calls a triangle original if the circumcircle of that triangle passes through the origin. Since Kevin believes that the circles of bovine life are tied directly to such triangles, he wants to know the number of original triangles formed by unordered triples of distinct lines.

Recall that the circumcircle of a triangle is the circle which passes through all the vertices of that triangle.

输入格式

The first line of the input contains a single integer $n$ ( $3<=n<=2000$ ), the number of lines.

The next $n$ lines describe lines ![](/uploads/luogu/CF603D/5a13e2b3a85a983e824447071c69046417c7bab6_37a44f92d433.png). The $i$ -th of these lines contains three space-separated integers $a_{i},b_{i},c_{i}$ ( $|a_{i}|,|b_{i}|,|c_{i}|<=10000,a_{i}^{2}+b_{i}^{2}>0$ ), representing the equation $a_{i}x+b_{i}y=c_{i}$ of line ![](/uploads/acgo/image/3c9cd2c09cbeea12_ccd19bb1cbb9.jpeg).

输出格式

Print a single integer, the number of triples $(i,j,k)$ with $i<j<k$ such that lines ![](/uploads/acgo/image/b4da86e3adc83e41_5d7baec02d7e.jpeg) form an original triangle.

输入输出样例

输入 #1
4
1 0 0
0 1 0
1 1 -1
1 -1 2
输出 #1
2
输入 #2
3
0 1 1
1 1 2
1 -1 -2
输出 #2
1
C++ 编辑器
输入
输出