4025. calculate pi

Naive基本数据类型循环

时间限制:2000 ms

内存限制:512 MiB

题面

The series used to approximate π\pi , π4113+1517+19111+\frac{\pi}{4} \cong 1-\frac{1}{3}+\frac{1}{5}-\frac{1}{7}+\frac{1}{9}-\frac{1}{11}+\ldots , converges extremely slowly. Even after 10,000 terms have been evaluated, the approximation is correct only to four digits. Using this technique to compute π\pi to the limit of floating-point precision would be impractical. The following series converges much more quickly:

π612+(12)13(12)3+(12×34)15(12)5+(12×34×56)17(12)7+\frac{\pi}{6} \cong \frac{1}{2}+\left(\frac{1}{2}\right) \frac{1}{3}\left(\frac{1}{2}\right)^{3}+\left(\frac{1}{2} \times \frac{3}{4}\right) \frac{1}{5}\left(\frac{1}{2}\right)^{5}+\left(\frac{1}{2} \times \frac{3}{4} \times \frac{5}{6}\right) \frac{1}{7}\left(\frac{1}{2}\right)^{7}+\ldots

Each term can be divided into three parts, as suggested by the parentheses in the formula. Figure out how each part changes from term to term and use this information to write a program that calculates π\pi to the limit of floating-point accuracy. Display your answer with 10 decimal places.