~/algor $ cat problems/ishorasi-almashinuvchi-qator
Alternating series
Easy
1000 ms
64 MB
26%
A positive integer $N$ is given. Compute the alternating sum of $N$ terms:
$$S = 1.1 - 1.2 + 1.3 - 1.4 + \dots$$
The absolute value of the $k$-th term is $1 + 0.1 * k$; terms in odd positions are added, terms in even positions are subtracted.
Input
One positive integer $N$.
Output
One number — $S$, with exactly 2 digits after the decimal point (for example, 1.10).
Note
$1 \le N \le 50$
Examples
Input #1
1
Output #1
1.10
Input #2
2
Output #2
-0.10