3006.Calculating Function

Time Limit: 1s Memory Limit: 256MB

For a positive integer n let's define a function f:

f(n)=-1+2-3+..+(-1)nn

Your task is to calculate f(n) for a given integer n.

Input Format(From the terminal/stdin)

The single line contains the positive integer n (1 \le n \le 1015).

Output Format(To the terminal/stdout)

Print f(n) in a single line.

Sample Input 1

Copy
4
 \n

Sample Output 1

Copy
2
 \n

Sample Input 2

Copy
5
 \n

Sample Output 2

Copy
-3
  \n

Hints

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

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

Submit

请先 登录

© 2025 FAQs