计算函数


Submit solution

Points: 10
Time limit: 1.0s
Memory limit: 4M

Author:
Problem type
Allowed languages
C++

计算函数

对于正整数 n,定义一个函数 f(n) 如下: \(f(n)=-1+2-3+4-5+⋯+(-1)^n n \)

你的任务是计算给定整数 \(n\) 的 \(f(n)\)。

输入

输入一行,包含一个正整数 \(n\) (\(1 \le n \le 10^{15}\))。

输出

输出一行,打印 f(n)。

输入:
4
输出:
2
输入:
5
输出:
-3
说明

\(f(4) = -1 + 2 - 3 + 4 = 2\)
\(f(5) = -1 + 2 - 3 + 4 - 5 = -3\)


Comments

There are no comments at the moment.