eolymp
bolt
Try our new interface for solving problems
Problems

Largest inscribed rectangle

Largest inscribed rectangle

Output the maximum area of a rectangle that can be inscribed into a circle of radius \textbf{r}. Rectangle's shorter side should not be longer than \textbf{b}. \includegraphics{https://static.e-olymp.com/content/69/6993cf4a8b8852468c657c0a5058fcdbd84741d4.jpg} \InputFile First line contains the number of test cases \textbf{t }(\textbf{1 }≤ \textbf{t }≤ \textbf{1000}). Next \textbf{t }lines each contain two integers \textbf{r} and \textbf{b }(\textbf{1 }≤ \textbf{r}, \textbf{b }≤ \textbf{10000}). \OutputFile For each test case print on a separate line the maximum area of a rectangle with a maximum shorter side \textbf{b }that can be inscribed into a circle of radius \textbf{r}. Your answer should be rounded to three digits after the decimal point (see sample output).
Time limit 1 second
Memory limit 64 MiB
Input example #1
3
1 1
1 2
2 2
Output example #1
1.732
2.000
6.928
Author Hichem Zakaria Aichour
Source 2013 Calgary Collegiate Programming Contest, Problem F