+ 2
Coding challenge: egg timer in a matrix ;)
You got a random filled (0 to 9) matrix of N*N integer elements (user chose N). You have to create a vector with N elements so that it contains the elements of an egg timer made in the following way. Trace the two diagonals of the square matrix: all the elements contained in these diagonals (diagonals included) form the egg timer. The elements to be inserted into the vector are calculated by adding the column portions delimited by egg timer. Print the matrix and the vector. Look next post for an example.
5 Respostas
+ 2
Example:
5*5 matrix
1 2 4 7 3
9 5 3 2 6
2 4 6 1 8
1 0 0 8 9
7 5 3 2 4
The egg timer is formed by:
1 9 2 1 7 from first column
5 4 0 from second column
6 from third column
2 1 8 from fourth column
3 6 8 9 4 from fifth column
So in the vector you have to put:
20 (sum of 1 9 2 1 7)
9 (sum of 5 4 0)
6 (sum of 6)
11 (sum of 2 1 8)
30 (sum of 3 6 8 9 4)
+ 2
Hope I got it right ...
https://code.sololearn.com/c43fP3AUm0dk/?ref=app
+ 2
yes weird translater...may egg timer is better
0
You lost me on what an hour glass is 😅
... okay, I think I get it