71. Running Total of Savings

Acceptance — 0 accepted 0 submissions

Easy
ArraysPrefix Sum
No companies listed
Sneha saves some money in her piggy bank every week. She wants to see how much she has after each week.

Given the weekly savings, print the running total after each week.

Input Format
The first line has n.
The second line has n integers, the savings each week.

Output Format
Print n numbers separated by spaces. The i-th number is the total of the first i weeks.

Constraints
• 1 ≤ n ≤ 1000
• 0 ≤ saving ≤ 10^4

Example 1

Input
4
100 50 0 200
Output
100 150 150 350

Explanation After week 1: 100, week 2: 150, week 3: 150, week 4: 350.

Example 2

Input
1
500
Output
500

Explanation Only one week.

Example 3

Input
5
1 1 1 1 1
Output
1 2 3 4 5

Explanation 1, 2, 3, 4, 5.

Acceptance —
Accepted 0
Submissions 0
Auto-save
Saved Ln 1, Col 1
Submit a solution to see its status here.
Input
Expected Output
100 150 150 350
No results yet
Run your code to test it against the sample cases.
Problem List