#C11701. Cumulative Sequence Generation
Cumulative Sequence Generation
Cumulative Sequence Generation
Given an integer \(n\), generate a sequence of length \(n\) where the \(i\)-th element is defined as the cumulative sum of all integers from 0 to \(i\). More formally, the sequence \(a\) is defined as:
\(a_0 = 0\) and \(a_i = a_{i-1} + i, \quad \text{for } i \ge 1\).
For example:
- For \(n=5\), the sequence is: 0, 1, 3, 6, 10.
- For \(n=3\), the sequence is: 0, 1, 3.
- For \(n=6\), the sequence is: 0, 1, 3, 6, 10, 15.
Your task is to compute and print the sequence corresponding to the given integer \(n\).
inputFormat
The input consists of a single integer (n) ((n \ge 0)) read from standard input.
outputFormat
Output the generated sequence in one line. The elements should be separated by a single space. If (n = 0), output nothing.## sample
3
0 1 3