HDU 1140:http://acm.hdu.edu.cn/showproblem.php?pid=1140
The center of the Earth is (0,0,0), give you K-satellite and K-satellite three-dimensional coordinates (based on the center of the Center), M on the Earth's point and the M-point of the three-dimensional coordinates (based on the center of the Center), asked how many points are able to be covered by the satellite, the output quantity.
Ideas:
To find the length of the tangent of the satellite and the Earth, on earth, the length of the link with the satellite is less than the length of the tangent can be seen.
More Wonderful content: http://www.bianceng.cnhttp://www.bianceng.cn/Programming/sjjg/
#define PI ACOs ( -1.0) struct point {Double x, y, Z;}
P[110];
Double distance (point A, point B) {return (a.x-b.x) * (a.x-b.x) + (A.Y-B.Y) * (A.Y-B.Y) + (a.z-b.z) * (A.Z-B.Z);}
int n, m;
void Solve () {double R = 20000.0/pi;
while (~SCANF ("%d%d", &n, &m)) {if (!n &&!m) {break;
for (int i = 0; i < n; ++i) {scanf ("%lf%lf%lf", &p[i].x, &p[i].y, &p[i].z);
int cnt = 0;
Point pp;
for (int i = 0; i < m ++i) {scanf ("%lf%lf%lf", &pp.x, &pp.y, &pp.z);
for (int j = 0; J < N; ++j) {Double D2 = p[j].x*p[j].x+p[j].y*p[j].y+p[j].z*p[j].z;
Double L2 = d2-r*r;
if (distance (P[j], pp) <= L2) {cnt++;
Break
} printf ("%d\n", CNT); }} HDU 1140