#C14377. Accumulate Sums
Accumulate Sums
Accumulate Sums
You are given a list of integers. Your task is to compute a new list where each element is replaced by the sum of all the elements up to and including that element.
Formally, given an array \(a_0, a_1, \ldots, a_{n-1}\), you need to produce an array \(s\) such that:
\(s_i = \sum_{j=0}^{i} a_j\)
The list can be empty. If it is empty, simply output nothing.
inputFormat
The input is read from standard input (stdin). The first line contains an integer \(n\) representing the number of elements in the list. The second line contains \(n\) space-separated integers.
If \(n = 0\), then no further input is provided.
outputFormat
Output to standard output (stdout) the accumulated sums as space-separated integers in a single line. If the list is empty, output nothing.
## sample4
1 2 3 4
1 3 6 10