Custom filling - 1. Diagonals
Problem
Write a program that fills a matrix with non-negative numbers along the diagonals (see example). The value of the matrix element is equal to the distance from the upper left corner of the matrix.
Input
The input string contains space-separated dimensions of the matrix: the number of rows N
and the number of columns M
(\(1 <=N, M <= 100\)).
Imprint
The program should output the resulting matrix row by row.
Examples
# |
Input |
Output |
1 |
4 5 |
0 1 2 3 4
1 2 3 4 5
2 3 4 5 6
3 4 5 6 7
|