#K67817. Canvas Pattern Generation
Canvas Pattern Generation
Canvas Pattern Generation
You are given a number of test cases, and for each test case, a single integer m representing the size of a canvas. Your task is to generate a pattern for each canvas in the following way:
For a canvas of size m, the pattern consists of m rows. The first row contains 1 number, the second row contains 2 numbers, and so on. The numbers in each canvas are consecutive natural numbers starting from 1. In other words, the numbers for the i-th row range from $$\frac{(i-1)i}{2}+1$$ to $$\frac{i(i+1)}{2}$$.
Output the pattern for each test case. Separate the output of consecutive test cases by a blank line.
inputFormat
The first line of input contains an integer T which denotes the number of test cases. This is followed by T lines where each line contains one integer m, the size of the canvas for that test case.
Example:
2 3 4
outputFormat
For each test case, output the generated pattern. The pattern for each case consists of m lines, with the i-th line containing i consecutive numbers separated by a single space. Print a blank line between the outputs of consecutive test cases.
Example output for the above input:
1 2 3 4 5 6## sample</p>1 2 3 4 5 6 7 8 9 10
1
3
1
2 3
4 5 6
</p>