
129  ZOJ Monthly, December 2013  J
Actually, extraterrestrials had arrived at the earth in 10 thousands years ago, and they monitored the creature on the earth, especially for their process and evolution. They put some monitors on the (x_{i}, y_{i}) (x_{i} is longitude, y_{i} is latitude, and both of them are integers), and then drove UFO to the earth to collect and analysis the data from earth. For some reasons, they can only receive data from monitors whose spherical distance to them is not longer than m kilometers. Now, they want to know that how many monitors' data could they receive when the UFO at the point(x_{i}, y_{i}), as mentioned above. InputThere are multiple input cases. For each case, the first line contains two integers n and m, n is the times of operating, m is as mentioned above.Then followed by n lines, each line contains a char op and two integers x_{i}, y_{i}. When op equals 'i', it means put a monitor on (x_{i}, y_{i}). If op equals 'c', you should output the number of monitors that its' data could be received by UFO landing on (x_{i}, y_{i}). You could suppose the earth is a normal sphere, and the radius of the earth is 6378 kilometres. (180 <= x_{i} < 180, 90 <= y_{i} <= 90, 0 < n <=30000, 0 <= m) OutputWhen op equals 'c', you should output one line, it contains a integer, as mentioned above. Sample Input3 300 i 0 0 i 0 90 c 1 1 Sample Output1 HintThe spherical distance between two points, (x_{1} , y_{1}) and (x_{2} , y_{2}), is r*arccos(sin(y_{1})*sin(y_{2})+cos(y_{1})*cos(y_{2})*cos(x_{1}x_{2})), x is longitude, y is latitude and r is radius. Please note the floating point error! Author: GU, Xuanzhi 