#K54707. Ordered Matrix Generation
Ordered Matrix Generation
Ordered Matrix Generation
Given two positive integers (n) and (m), generate a matrix with (n) rows and (m) columns such that each row is in ascending order from left to right and each column is in ascending order from top to bottom. The matrix is defined by the formula: [ A[i][j] = i + j + 1, \quad 0 \le i < n, ; 0 \le j < m ] For example, when (n=3) and (m=3), the matrix is:
1 2 3 2 3 4 3 4 5
Read the input from standard input and output the matrix, where each row is printed on a new line with its elements separated by a single space.
inputFormat
The input consists of a single line containing two space-separated positive integers (n) and (m), representing the number of rows and columns of the matrix, respectively.
outputFormat
Output the generated matrix with (n) rows. Each row should contain (m) space-separated integers and each row should be printed on a new line.## sample
3 3
1 2 3
2 3 4
3 4 5
</p>