#C4057. Arithmetic Matrix Construction

    ID: 47553 Type: Default 1000ms 256MiB

Arithmetic Matrix Construction

Arithmetic Matrix Construction

Given a positive integer \(N\) (with \(2 \leq N \leq 100\)), construct an \(N \times N\) matrix \(A\) consisting of distinct positive integers that satisfies the following conditions:

  • Each row is strictly increasing.
  • Each column is strictly increasing.
  • The difference between any two consecutive elements in any row and any column is constant across the entire matrix.

In other words, the matrix is an arithmetic matrix in both rows and columns. For instance, if \(A[i][j] = i + j + 1\), then every row and every column increases by a constant difference of 1.

Your task is to generate such a matrix and output it line by line, where each line contains \(N\) space-separated integers.

inputFormat

The input consists of a single integer \(N\) (\(2 \leq N \leq 100\)) representing the number of rows and columns of the matrix.

outputFormat

Output the \(N \times N\) matrix such that each row is printed on a new line and the elements in each row are separated by a single space.

## sample
2
1 2

2 3

</p>