#K57167. Generate Special Sequence
Generate Special Sequence
Generate Special Sequence
Given a non-negative integer n, your task is to generate a sequence of n distinct positive integers S = [S0, S1, ..., Sn-1] that satisfies the following conditions:
- The sequence must start with 1, i.e. S0 = 1.
- The sequence is strictly increasing: S0 < S1 < ... < Sn-1.
- For any two elements Si and Sj with i < j, if the difference is \(k = S_j - S_i\) (where \(k > 1\)), then there must be at least \(k-1\) elements between them in the sequence. In other words, if the element Sj is added as the \(m^{th}\) number (i.e. at index m where m = j), then it must hold that:
\[ S_j - S_i \geq (j - i) + 1 \] for all 0 ≤ i < j < n.
For example:
- For n = 1, the sequence is [1].
- For n = 3, the sequence is [1, 2, 4].
- For n = 5, the sequence is [1, 2, 4, 5, 7].
- For n = 10, the sequence is [1, 2, 4, 5, 7, 8, 10, 11, 13, 14].
- For n = 0, the sequence is empty.
Your program should read the input from standard input (stdin) and output the generated sequence to standard output (stdout) as space-separated integers on a single line. If the sequence is empty, output an empty line.
inputFormat
The input consists of a single integer n (0 ≤ n ≤ 1000
), which denotes the length of the sequence to generate.
outputFormat
Output the generated sequence as space-separated integers on one line. If n is 0, output an empty line.
## sample1
1