Optimal use of Nuclear Power plant

All submissions for this problem are available.
It is now 2050 AD. A city will be built under large protective circular dome. A nuclear power plant (NPP) built outside the city will power the whole city. For safety reasons the NPP must be at least d_{min} distance away from the dome. The radius of the dome has not been fixed yet. The houses inside the dome will be built after building the dome. So for simplicity it can be assumed that each location under the dome is equally likely to have a house. In other words houses will be uniformly distributed in the land inside the dome. As the houses are full of modern electrical equipments, so the power consumption per house is quite high. So each house is connected with the NPP with the shortest possible cable underground. In the figure below you can see four houses (Blue circles) and their shortest connection with NPP (dotted line). For wiring cost and lineloss issues the average distance of the houses (assuming they are uniformly distributed under then dome) from the NPP cannot be more than D_{avg}.
Given the value of D_{avg}, d_{min} your job is to find the maximum possible value of the radius of the land under dome.
Input
First line of the input file contains an integer T (0 < T ≤ 20) which denotes how many test cases to follow. Each of the next T lines contains two strictly positive integers D_{avg} (0 < D_{avg} <1000) and d_{min} (0 < d_{min} < D_{avg}). The meaning of D_{avg} and d_{min} are given in the problem statement above.
Output
For each test case produce one line of output. This line contains a floatingpoint number R_{max}, which denotes maximum possible value of the radius of the circular land under the dome maintaining the constraints imposed by D_{avg} and d_{min}. This value should be rounded to four digits after the decimal point. Errors not exceeding 1.5 * 10^{4} will be ignored.
Sample
Input 2 100 20 10 5 Output 72.6679 4.7114
Author:  kol_adm 
Editorial  https://discuss.codechef.com/problems/KOL16G 
Tags  acm16kol, geometry, hard, integrals, kol_adm 
Date Added:  21122016 
Time Limit:  4 sec 
Source Limit:  50000 Bytes 
Languages:  C, CPP14, JAVA, PYTH, PYTH 3.6, PYP3 
Comments
 Please login at the top to post a comment.
SUCCESSFUL SUBMISSIONS
Fetching successful submissions
HELP
If you are still having problems, see a sample solution here. 