Hi all, has anyone done such a task? Don't understand problem solving. How to generate such matrices?

asked April 19th 20 at 12:37

1 answer

answered on

Solution

In my opinion, everything is simple:

a) the Matrix must consist of zeros, except the secondary diagonal. Elements of the secondary diagonal is n (n-1) (n-2) ... 1.

b) the Matrix whose rows consist of 1, 2, 3 ... n.

c) the Matrix whose main diagonal consists of ones. The value of the last column decreases by 1 on each next line to 1. With the "left" part of the main diagonal must be zero-filled, and the "right" part incrementing by 1 to (n-1) (n-2) and so on in accordance with the line.

d) the Matrix whose first row and column 1. The second row and column +1. The third row and column is +1 ... and so on up to n.

PS the key thing to bear in mind that all matrices are square, so this is not a difficult task.

a) the Matrix must consist of zeros, except the secondary diagonal. Elements of the secondary diagonal is n (n-1) (n-2) ... 1.

b) the Matrix whose rows consist of 1, 2, 3 ... n.

c) the Matrix whose main diagonal consists of ones. The value of the last column decreases by 1 on each next line to 1. With the "left" part of the main diagonal must be zero-filled, and the "right" part incrementing by 1 to (n-1) (n-2) and so on in accordance with the line.

d) the Matrix whose first row and column 1. The second row and column +1. The third row and column is +1 ... and so on up to n.

PS the key thing to bear in mind that all matrices are square, so this is not a difficult task.

Find more questions by tags Java