

実行時間制限: 2 sec / メモリ制限: 1024 MiB
配点 : 100 点
問題文
正整数 N が与えられます。
i=1,2,\ldots,N について (-1)^i \times i^3 を計算したときの、それら N 個の値の総和を求めてください。
すなわち、 \displaystyle \sum_{i=1}^N (-1)^i \times i^3 を求めてください。
制約
- N は 1 以上 10 以下の整数
入力
入力は以下の形式で標準入力から与えられる。
N
出力
\displaystyle \sum_{i=1}^N (-1)^i \times i^3 の値を出力せよ。
入力例 1
3
出力例 1
-20
- i=1 のとき: (-1)^i\times i^3=-1 です。
- i=2 のとき: (-1)^i\times i^3=8 です。
- i=3 のとき: (-1)^i\times i^3=-27 です。
したがって、 -1 + 8 - 27 = -20 を出力してください。
入力例 2
9
出力例 2
-425
入力例 3
10
出力例 3
575
Score : 100 points
Problem Statement
You are given a positive integer N.
For i=1,2,\ldots,N, calculate (-1)^i \times i^3, and find the sum of these N values.
That is, find \displaystyle \sum_{i=1}^N (-1)^i \times i^3.
Constraints
- N is an integer between 1 and 10, inclusive.
Input
The input is given from Standard Input in the following format:
N
Output
Output the value of \displaystyle \sum_{i=1}^N (-1)^i \times i^3.
Sample Input 1
3
Sample Output 1
-20
- When i=1: (-1)^i\times i^3=-1.
- When i=2: (-1)^i\times i^3=8.
- When i=3: (-1)^i\times i^3=-27.
Therefore, output -1 + 8 - 27 = -20.
Sample Input 2
9
Sample Output 2
-425
Sample Input 3
10
Sample Output 3
575