53. Prefix Sums
EasyArrayPrefix Sum
Print the running (prefix) sums of the array: the i-th output is a₁ + … + aᵢ.
Input format
Line 1: n Line 2: n integers
Output format
n prefix sums, space-separated.
Example 1
Input
4 1 2 3 4
Output
1 3 6 10
Example 2
Input
3 5 -5 5
Output
5 0 5
Constraints
1 ≤ n ≤ 10⁵
Read input from standard input and print the answer to standard output. Your code is judged against 6 test cases, most of them hidden.
Loading the MyLoginn IDE…