A12637 | Power Transmission (Easy Edition)
时间限制1s
内存限制256MB
通过 / 提交0/0
题目描述
This problem is same as the next one, but has smaller constraints.
It was a Sunday morning when the three friends Selena, Shiro and Katie decided to have a trip to the nearby power station (do not try this at home). After arriving at the power station, the cats got impressed with a large power transmission system consisting of many chimneys, electric poles, and wires. Since they are cats, they found those things gigantic.
At the entrance of the station, there is a map describing the complicated wiring system. Selena is the best at math among three friends. He decided to draw the map on the Cartesian plane. Each pole is now a point at some coordinates $(x_i, y_i)$ . Since every pole is different, all of the points representing these poles are distinct. Also, every two poles are connected with each other by wires. A wire is a straight line on the plane infinite in both directions. If there are more than two poles lying on the same line, they are connected by a single common wire.
Selena thinks, that whenever two different electric wires intersect, they may interfere with each other and cause damage. So he wonders, how many pairs are intersecting? Could you help him with this problem?
It was a Sunday morning when the three friends Selena, Shiro and Katie decided to have a trip to the nearby power station (do not try this at home). After arriving at the power station, the cats got impressed with a large power transmission system consisting of many chimneys, electric poles, and wires. Since they are cats, they found those things gigantic.
At the entrance of the station, there is a map describing the complicated wiring system. Selena is the best at math among three friends. He decided to draw the map on the Cartesian plane. Each pole is now a point at some coordinates $(x_i, y_i)$ . Since every pole is different, all of the points representing these poles are distinct. Also, every two poles are connected with each other by wires. A wire is a straight line on the plane infinite in both directions. If there are more than two poles lying on the same line, they are connected by a single common wire.
Selena thinks, that whenever two different electric wires intersect, they may interfere with each other and cause damage. So he wonders, how many pairs are intersecting? Could you help him with this problem?
输入格式
The first line contains a single integer $n$ ( $2 \le n \le 50$ ) — the number of electric poles.
Each of the following $n$ lines contains two integers $x_i$ , $y_i$ ( $-10^4 \le x_i, y_i \le 10^4$ ) — the coordinates of the poles.
It is guaranteed that all of these $n$ points are distinct.
Each of the following $n$ lines contains two integers $x_i$ , $y_i$ ( $-10^4 \le x_i, y_i \le 10^4$ ) — the coordinates of the poles.
It is guaranteed that all of these $n$ points are distinct.
输出格式
Print a single integer — the number of pairs of wires that are intersecting.
输入输出样例
输入 #1
4 0 0 1 1 0 3 1 2
输出 #1
14
输入 #2
4 0 0 0 2 0 4 2 0
输出 #2
6
输入 #3
3 -1 -1 1 0 3 1
输出 #3
0
In the first example:
In the second example:
Note that the three poles $(0, 0)$ , $(0, 2)$ and $(0, 4)$ are connected by a single wire.
In the third example:

In the second example:
Note that the three poles $(0, 0)$ , $(0, 2)$ and $(0, 4)$ are connected by a single wire.
In the third example:

C++ 编辑器
输入
输出
可保存默认模板;新题优先使用已保存模板。
当前快捷键仅展示,暂不支持修改。
- 撤销
Ctrl / ⌘ + Z - 重做
Ctrl / ⌘ + Y - 查找
Ctrl / ⌘ + F - 全选
Ctrl / ⌘ + A - 复制
Ctrl / ⌘ + C - 剪切
Ctrl / ⌘ + X - 粘贴
Ctrl / ⌘ + V - 自动排版
工具栏排版按钮 - 草稿保存
编辑时自动保存到本机
历史
提交记录
状态说明时间源码
AI
作答助手
你好,我是作答助手。可以问思路、复杂度、样例含义或代码报错原因;不会直接给出完整 AC 代码。
确定要清空代码吗?
提交通过
评测结果:Accepted