#K2756. Matrix Construction from Multiplicative Indices
Matrix Construction from Multiplicative Indices
Matrix Construction from Multiplicative Indices
Given an integer N, your task is to construct an N×N matrix where each element at the i-th row and j-th column is defined by the formula $i \times j$, where indices i and j start from 0. After constructing the matrix, flatten it into a single line by concatenating its rows with a single space separating the numbers.
For example, if N = 3, the matrix is:
0 0 0 0 1 2 0 2 4
and the output should be:
0 0 0 0 1 2 0 2 4
inputFormat
The input is provided via stdin and follows this format:
T N1 N2 ... NT
Here, T is the number of test cases, followed by T integers where each integer N represents the size of the matrix for that test case.
outputFormat
For each test case, output a single line (via stdout) containing the flattened matrix. Each value in the matrix should be separated by a single space.
## sample1
1
0