Largest inscribed rectangle
InterviewTime limit2sMemory limit256 MB
Given radius R and bound B, find the largest area of a rectangle inscribed in the circle whose shorter side is at most B.
Problem
A rectangle is inscribed in a circle of radius when all four of its corners lie on the circle. Find the largest area of an inscribed rectangle whose shorter side is at most . A square counts as a rectangle.
Input
The first line contains an integer , the number of test cases (). Each of the next lines contains two integers and separated by a space ().
Output
For each test case print the maximum area on its own line, rounded to three digits after the decimal point. Always print exactly three digits after the decimal point.