#C10334. Flower Bed Pattern Generation
Flower Bed Pattern Generation
Flower Bed Pattern Generation
Given two integers, m and k, generate a pattern matrix of size \(m \times m\) where each element at index \(i, j\) (with \(0 \leq i, j < m\)) is calculated as:
\(A_{i,j} = i^2 + j^2 + k\)
The program should support multiple test cases. For each test case, you need to output the generated matrix with each row on a new line and a single space between numbers, separating different test cases with an empty line.
inputFormat
The first line contains an integer T, the number of test cases. Each of the following T lines contains two space-separated integers m and k.
outputFormat
For each test case, output the generated \(m \times m\) pattern matrix. Each row should be printed on a new line with its elements separated by a single space. Print an empty line between the outputs of consecutive test cases.
## sample1
3 2
2 3 6
3 4 7
6 7 10
</p>