Hackerland has n houses in the \(xy\) plane . You are given x and y coordinates of all the n houses. You plan to drop a bomb on hackerland. The bomb you possess has a destruction radius of D . Formally, if you drop the bomb at point \((a,b)\), all houses within a distance D from this point will be destroyed. You decide to drop the bomb at a point selected uniformly randomly inside a circle of radius R, centered at \((0,0)\). Find the expected value of the number of houses destroyed by the bomb.
Input
The first line contains n, D, and R respectively.
It is followed by n lines.The \(i^{\text{th}}\) line contains two integers \(x_i\), and \(y_i\), representing x and y coordinates of the \(i^{\text{th}}\) house.
Output
Output a single line containing the expected value of number of houses destroyed by the bomb to exactly 4 digits after the decimal point. This is equivalent to printf("%.4lf", value)
in C.
Constraints
\(n,D,R,x_i,y_i\) are integers
\(1 \le n,D,R \le 10^6\)
\( -10^6 \le x_i,y_i \le 10^6\)
Because \(D = 2\), and \(R=1\), no matter where you drop the bomb inside a circle of radius R centered at \((0,0)\), the point \((0,0)\) will always be destroyed. So one house is destroyed no matter where the bomb is dropped. Hence, expected value of number of houses destroyed is 1.
Please login to use the editor
You need to be logged in to access the code editor
Loading...
Please wait while we load the editor
Login to unlock the editorial
Please login to use the editor
You need to be logged in to access the code editor
Loading...
Please wait while we load the editor