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  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  . 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.
For each triple $(i,j,k)$ such that $1<=i<j<k<=n$ , Kevin considers the triangle formed by the three lines  . 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 . 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 .
The next $n$ lines describe lines . 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 .
输出格式
Print a single integer, the number of triples $(i,j,k)$ with $i<j<k$ such that lines  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
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).$
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).$
C++ 编辑器
输入
输出
可保存默认模板;新题优先使用已保存模板。
当前快捷键仅展示,暂不支持修改。
- 撤销
Ctrl / ⌘ + Z - 重做
Ctrl / ⌘ + Y - 查找
Ctrl / ⌘ + F - 全选
Ctrl / ⌘ + A - 复制
Ctrl / ⌘ + C - 剪切
Ctrl / ⌘ + X - 粘贴
Ctrl / ⌘ + V - 自动排版
工具栏排版按钮 - 草稿保存
编辑时自动保存到本机
历史
提交记录
状态说明时间源码
AI
作答助手
你好,我是作答助手。可以问思路、复杂度、样例含义或代码报错原因;不会直接给出完整 AC 代码。
确定要清空代码吗?
提交通过
评测结果:Accepted