Time limit 2000/4000/4000/4000 ms. Memory limit 65000/65000/65000/65000 Kb. bfs.
Plane Segmentation
Question:
The plane equation in three dimensional space can be defined as:
ax + by +cz + d=0
Where a, b and c are plane parameters and d is distance of plane from the origin.
A point lies on plane if ax + by +cz + d=0
Write a program which counts how many of this points lie on the plane.
Input Specifications: In the first line you will be given 4 coefficients of the plane (a, b, c, d) than in the following three lines x, y, z coordinates of four points. where -20000<=a,b,c<=20000, -18000000<=d<=18000000, and -100<=x,y,z<=100 .
Output Specifications: Show how many points lie on the plane.
Sample Input I
-4 2 3 -3 2 2 1 2 0 3 3 2 5 |
Sample Input II
2 2 2 -18 1 2 6 5 1 5 3 2 4 |
Sample Output I
0 |
Sample Output II
2 |
Sample Input II Explanation:
Based on plane equation we check if the points lie on plane or not.
Check Point 1
equation= ax + by +cz + d=1*2 + 2*2 + 2*6 + (-18)=2+4+12-18=0
Check Point 2
equation= ax + by +cz + d=2*5 + 2*1 + 2*5 + (-18)=10+2+5-18=4
Check Point 2
equation= ax + by +cz + d=2*3 + 2*2 + 2*4 + (-18)=6+4+8-18=0
Total number of points lying on plane is 2
Для отправки решений необходимо выполнить вход.
|