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

PROGRAMMING:Finding the partial sum of simple interleaved sequences with given precision

Luz5年前 (2021-05-10)题库452
This problem requires programming to calculate the sequence part and 1 - 1 / 4 + 1 / 7 - 1 / 10 +... Until the absolute value of the last item is not greater than the given precision EPS.
###Input format:
The input gives a positive real number EPS in one line.
###Output format:
In one line, output the value s of partial sum in the format of "sum = s", accurate to six decimal places. The calculation results should not exceed the double precision range.
###Input sample 1:
```in
4E-2
```
###Output sample 1:
```out
sum = 0.854457
```
###Input sample 2:
```
zero point zero two
```
###Output sample 2:
```
sum = 0.826310
```






answer:If there is no answer, please comment