CF603D Ruminations on Ruminants

题目描述

有 $n$ 条直线,两两不平行,任意 $3$ 条直线不经过同一个点。求三条直线围成的三角形的外接圆过原点的方案数。

输入格式

输入的第一行有一个整数$n$($3\leq n\leq 2000$) 第二行到第 $n+1$ 行有三个整数 $a_i,b_i,c_i$($a_i,b_i,c_i\leq 10000$)表示第 $i$ 条直线的方程为$a_ix+b_iy=c_i$

输出格式

输出无序整数对$(i,j,k)$的个数使这三条直线围成的三角形的外接圆过原点。

说明/提示

Note that in the first sample, some of the lines pass through the origin. In the second sample, there is exactly one triple of lines: $ y=1,x+y=2,x-y=-2. $ The triangle they form has vertices $ (0,2),(1,1),(-1,1) $ . The circumcircle of this triangle has equation $ x^{2}+(y-1)^{2}=1 $ . This indeed passes through $ (0,0). $