#C14808. Cumulative Sum Sequence
Cumulative Sum Sequence
Cumulative Sum Sequence
Given a list of integers, compute the cumulative sum sequence. The cumulative sum sequence is defined as follows: (S_i = \sum_{j=1}^{i} a_j), where (a_j) is the j-th element of the list. Your task is to output the sequence of cumulative sums for the input numbers.
For example, if the input is 1 2 3 4
, the output should be 1 3 6 10
.
inputFormat
The first line contains an integer (n) ((0 \leq n \leq 10^5)) representing the number of elements. The second line contains (n) space-separated integers (a_1, a_2, ..., a_n).
outputFormat
Print the cumulative sum sequence as (n) space-separated integers on one line. If (n = 0), output an empty line.## sample
4
1 2 3 4
1 3 6 10
</p>