第十八屆中山大學程式設計競賽網路預選賽B題
阿新 • • 發佈:2019-02-08
Common Area
Description
Given a circle and a square whose centers coincide with each other, your task is to calculate the common area of them.
Input
The input begins with an integer T (T <= 1000), indicating the number of test cases. Each case contains two integers r and d (1 <= r, d <= 1000), indicating the radius of the circle, and the length of each side of the square, respectively.
Output
For each case, output the common area in a line. The answer should be given with an absolute or relative error of at most 10-6.
Sample Input and Sample Output
Sample Input Sample Output
23.1415926536
1 262.1897054604
5 8
Description
Given a circle and a square whose centers coincide with each other, your task is to calculate the common area of them.
Input
The input begins with an integer T (T <= 1000), indicating the number of test cases. Each case contains two integers r and d (1 <= r, d <= 1000), indicating the radius of the circle, and the length of each side of the square, respectively.
Output
For each case, output the common area in a line. The answer should be given with an absolute or relative error of at most 10-6.
Sample Input and Sample Output
Sample Input Sample Output
23.1415926536
1 262.1897054604
5 8