#P7599. [2018年杭电多校]oval-and-rectangle
[2018年杭电多校]oval-and-rectangle
oval-and-rectangle
Problem Description
Patrick Star find an oval. The half of longer axes is on the x-axis with length . The half of shorter axes is on the y-axis with length . Patrick Star plan to choose a real number randomly from , after that, Patrick Star will get a rectangle :
- The four vertexes of it are on the outline of the oval.
- The two sides of it parallel to coordinate axis.
- One of its side is . Patrick Star want to know the expectations of the rectangle's perimeter.
Input
The first line contain a integer (no morn than 10), the following is test case, for each test case : Each line contains contains two integer a, b (). Separated by an white space.
Output
For each test case output one line denotes the expectations of the rectangle's perimeter . You should keep exactly 6 decimal digits and ignore the remain decimal digits. It is guaranted that the 7-th decimal digit of answer wont be 0 or 9.
Sample Input
1
2 1
Sample Output
8.283185
Source
2018 Multi-University Training Contest 6