EasyRating 800
Alternating Series
Compute f(n) = −1 + 2 − 3 + 4 − … ± n.
Input
One integer n (1 ≤ n ≤ 10¹⁵).
Output
f(n)
Sample 1
Input
4
Output
2
Sample 2
Input
5
Output
-3
Output appears hereOne integer n (1 ≤ n ≤ 10¹⁵).
f(n)
4
2
5
-3
Output appears here