M
M
Matef2020-11-11 20:00:07
C++ / C#
Matef, 2020-11-11 20:00:07

How to solve a square matrix problem?

In general, I can not understand in any way what the conditions of the task are. Please explain the condition and how it can be done in c++.
5fac188b65389293272484.png

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
scottparker, 2020-11-11
@Matef

You have a two-dimensional array NxN, you need to get a one-dimensional array of length N. Each element of the one-dimensional array (to be obtained) is equal to the sum of some elements of the corresponding (by number, i.e. the 0th element of the array will be obtained from the elements of the 0th row of the matrix ) rows from the matrix. The sums can be of two types:
1) the element of the line that lies on the main diagonal < 0, then you are looking for the sum of the elements of this line, starting from the 0th element to the first negative
2) the element of the line that lies on the main diagonal => 0, then you are looking for the sum of the elements of this line, starting from the first non-negative element and up to the end of the line,
well, write the code yourself. only help if there is already something

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question