F - Double Sum
解説
/
実行時間制限: 2 sec / メモリ制限: 1024 MB
配点 : 点
問題文
整数列 が与えられます。
次の式を計算してください。
なお、制約下において答えが 未満となることは保証されています。
制約
- 入力される値は全て整数
入力
入力は以下の形式で標準入力から与えられる。
出力
式の値を出力せよ。
入力例 1Copy
Copy
3 2 5 3
出力例 1Copy
Copy
4
のとき です。
のとき です。
のとき です。
これらを足し合わせた が答えとなります。
入力例 2Copy
Copy
10 5 9 3 0 4 8 7 5 4 0
出力例 2Copy
Copy
58
Score: points
Problem Statement
You are given an integer sequence .
Calculate the following expression:
The constraints guarantee that the answer is less than .
Constraints
- All input values are integers.
Input
The input is given from Standard Input in the following format:
Output
Print the value of the expression.
Sample Input 1Copy
Copy
3 2 5 3
Sample Output 1Copy
Copy
4
For , we have .
For , we have .
For , we have .
Adding these together gives , which is the answer.
Sample Input 2Copy
Copy
10 5 9 3 0 4 8 7 5 4 0
Sample Output 2Copy
Copy
58