#abc263h. Ex - Intersection 2
Ex - Intersection 2
Score : points
问题描述
在二维平面上有 条直线。第 条直线的方程为 。保证没有两条直线是平行的。
在这个平面中,存在 个交点(包含重复的交点),它们是由任意两条直线相交得到的。请计算并输出原点与这 个点中第 近点的距离。
以上为通义千问 qwen-max 翻译,仅供参考。
Problem Statement
There are lines in a two-dimensional plane. The -th line is . It is guaranteed that no two of the lines are parallel.
In this plane, there are intersection points of two lines, including duplicates. Print the distance between the origin and the -th nearest point to the origin among these points.
Constraints
- $-1000 \le |A_i|,|B_i|,|C_i| \le 1000(1 \le i \le N)$
- No two of the lines are parallel.
- or .
- All values in input are integers.
Input
Input is given from Standard Input in the following format:
Output
Print a real number representing the answer.
Your output is considered correct when its absolute or relative error from the judge's output is at most .
Sample Input 1
3 2
1 1 1
2 1 -3
1 -1 2
Sample Output 1
2.3570226040
Let us call the -th line Line .
- The intersection point of Line and Line is , whose distance to the origin is .
- The intersection point of Line and Line is , whose distance to the origin is .
- The intersection point of Line and Line is , whose distance to the origin is .
Therefore, the second nearest intersection point is , and should be printed.
Sample Input 2
6 7
5 1 9
4 4 -3
8 -1 2
0 1 -8
4 0 -4
2 -3 0
Sample Output 2
4.0126752298
update @ 2024/3/10 11:08:38