#111. 按模式生成数字序列
按模式生成数字序列
Generate Sequence
Background
Congcong enjoys playing with number sequences. One day, he came up with an interesting sequence generation rule and wants you to help him implement it.
Problem Description
Given a non-negative integer , create an array with the pattern $\{1, \quad 1, 2, \quad 1, 2, 3, \quad \dots \quad 1, 2, 3, \dots, n\}$ (spaces added to show the grouping). Note that the length of the array will be , which is known to sum to exactly .
Input Format
Input is given from Standard Input in the following format.
An integer .
Output Format
Output is printed to Standard Output in the following format.
An integer array generated according to the pattern described in the problem.
Sample
3
[1, 1, 2, 1, 2, 3]
4
[1, 1, 2, 1, 2, 3, 1, 2, 3, 4]
2
[1, 1, 2]
Sample Explanation
When , the sequence consists of three parts: the first part is , the second part is , and the third part is . Concatenating them yields .
Constraints
Time limit: 1 second per test case. Memory limit: 1024 KiB per test case.