#CCBCHBA0000009. Tổng n số bất kỳ (Sum of N Integers)
Tổng n số bất kỳ (Sum of N Integers)
Sum of N Integers
Source: Phước Hưng OJ
Version: Phuoc Hung OJ Extended
Problem Statement
Read n integers and compute their sum without storing them. If n=0, the sum is zero.
Input
Integer n followed by exactly n integers.
Output
One signed 64-bit integer: the sum.
Subtasks
- Subtask 1 (20%): , .
- Subtask 2 (30%): , .
- Subtask 3 (50%): , .
Examples
Example 1
Input
4
5 -2 0 7
Output
10
Explanation
0+5-2+0+7=10.
Example 2
Input
0
Output
0
Explanation
There are no values, so the sum remains zero.