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

PROGRAMMING:Polynomial summation

Luz5年前 (2021-05-10)题库443
The polynomial is described as follows:
1 - 1/2 + 1/3 - 1/4 + 1/5 - 1/6 + ...
Now please find the sum of the first n terms of the polynomial.
(excerpt from Hangdian)
###Input format:
The input data consists of two lines. The first line is a positive integer m (m < 100), which represents the number of test cases. The second line contains M positive integers. For each integer (n, n < 1000), find the sum of the first n terms of the polynomial.
###Output format:
For each test case n, it is required to output the sum of the first n terms of the polynomial. The output of each test case occupies one line, and the result retains two decimal places.
###Input example:
```in
two
1 2
```
###Output example:
```out
one
zero point five zero
```
2015 working group < br > < br > < br > < br > < br >


answer:If there is no answer, please comment