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

PROGRAMMING:Approximate pi

Luz5年前 (2021-05-10)题库409
This problem requires the preparation of procedures, according to the following formula for the approximate value of $$$PI $$, until the last term is less than the given precision EPS.
$$\frac{\pi}{2}=1+\frac{1!}{ 3}+\frac{2!}{ 3\times 5} + \frac{3!}{ 3\times 5\times 7}+ \cdots +\frac{i!}{ 3\times 5\times \cdots \times (2\times i+1)}+ \cdots$$
###Input format:
The input gives the precision EPS in one line. You can use the following statement to read the input:
```c++
scanf("%le", &eps);
```
###Output format:
In one line, output the approximate value of $$\ PI $$(5 decimal places) in the following format:
```
Pi = approximate
```
###Input example:
```in
1E-5
```
###Output example:
```out
PI = 3.14158
```






answer:If there is no answer, please comment