Submit | All submissions | Best solutions | Back to list |
CRS - Crying Series |
Monir is a student of class 8. He loves to learn new logic from Mathematics. Divergent Geometric Series is an interesting topic to him. So, He starts practicing to find the sum of the series in his everyday life. So he pick a standard series for Nth term,
F(x) = (-1)*1 + (-1)2* 2 + (-1)3* 3 + ..... + (-1) N*N
In this case, He asks for your help to find the value (algebraic sum) of F(x) from given series. As you are a great programmer in our country.
Input
Every line of the input contains N.
Constraints
- 0 ≤ N ≤ 1015
Output
For each test case, print a single line and the value (algebraic sum of all elements) of F(x) from given series.
Example
Input: 0 1 2 Output: 0 -1 1
Added by: | asad_IT |
Date: | 2018-06-24 |
Time limit: | 0.300s |
Source limit: | 50000B |
Memory limit: | 1536MB |
Cluster: | Cube (Intel G860) |
Languages: | All |
Resource: | Math |
hide comments
2020-05-10 13:48:30
use while(cin >> n) to take input. Input contains multiple lines |
|
2018-07-02 14:36:30 asad
thanks. @wisfaq |
|
2018-06-24 15:25:11 wisfaq
Be careful: the sentence : The first line of the input contains a single integer N denoting the number of terms in the series is not correct. every line of the input contains an N. So process to eof. Why have others with AC not mentioned this? |
|
2018-06-24 14:09:38 asad
ok |
|
2018-06-24 13:24:17
should be moved to tutorial |