#K40492. Running Sum of Array

    ID: 26654 Type: Default 1000ms 256MiB

Running Sum of Array

Running Sum of Array

You are given an array of integers. Your task is to compute the running sum of the array. For each index (i) (1-indexed), the running sum (S_i) is defined as (S_i = \sum_{j=1}^{i} a_j). The number of elements in the array is between 1 and 50, inclusive.

inputFormat

The input is received from stdin in the following format:

  • The first line contains an integer \(N\) (\(1 \leq N \leq 50\)), the number of elements in the array.
  • The second line contains \(N\) space-separated integers.

outputFormat

Output to stdout the running sum of the array as a sequence of integers separated by a space. For each index (i), output (S_i = a_1 + a_2 + \cdots + a_i).## sample

4
1 2 3 4
1 3 6 10