-->
当前位置:首页 > 题库

PROGRAMMING:Circles Inside a Square

Luz5年前 (2021-05-10)题库382
You have 8 circles of equal size and you want to pack them inside a square. You want to
minimize the size of the square. The following figure illustrates the minimum way of packing 8
circles inside a square:
You have eight circles of the same size, and you want to put them in a square. You want to minimize the size of the square. The figure below illustrates the minimum method of 8-ring inner packing
![ x.png](~/942bee02-324c-45a9-baa1-de6846a0630d.png)
The P roblem:Given the radius, r, find the area of the minimum square into which 8 circles of that radius can
be packed.
Problem: given the radius, R, find out the area of the smallest square, where the radius of 8 circles can be filled.
###Input format:
The first input line contains a positive integer, n, indicating the number of test cases. Each test
case consists of a positive real number (between 0.001 and 1000, inclusive) in a single line
denoting the radius, r.
There is an input line, which consists of a positive real number (between 0.001 and 1000, inclusive), representing the radius, R.
###Output format:
For each test case, output the area of the minimum square where 8 circles of radius r can be
packed. Print 5 digits after the decimal. Your output is considered correct if it is within
± 0.00001 of the judge’s output.
Print the area of the smallest square, where eight circles of radius r can be packed. Print 5 digits after decimal. If your output is 0.00001 of the judge's output ± The output is considered to be correct.
###Input example:
Here is a set of inputs. For example:
```in
zero point one
zero point two
```
###Output example:
The corresponding output is given here. For example:
```out
zero point three four three eight three
one point three seven five three two
```







answer:If there is no answer, please comment