← 返回 tesla 的题目列表Distance from 3D Points to a Plane
类型:online_judge
Problem: Distance from 3D Points to a Plane
You are given n 3D points points[i] = (x_i, y_i, z_i) and a plane represented by:
a*x + b*y + c*z + d = 0
Compute the perpendicular distance from each point to the plane.
Input Format
n
x1 y1 z1
x2 y2 z2
...
xn yn zn
a b c d
Output Format
Print n lines. The i-th line should contain the distance from the i-th point to the plane, rounded to 6 decimal places.
Constraints
1 <= n <= 100000
-10^6 <= x_i, y_i, z_i, a, b, c, d <= 10^6
(a, b, c) is guaranteed not to be all zero.
Example
Input:
3
0 0 0
0 0 5
1 2 3
0 0 1 -2
Output:
2.000000
3.000000
1.000000
Example
Input
3
0 0 0
0 0 5
1 2 3
0 0 1 -2
Output
2.000000
3.000000
1.000000