+ 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.

29th Jul 2017, 1:25 PM
Andrea Simone Costa
Andrea Simone Costa - avatar
5 Respuestas
+ 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)
29th Jul 2017, 1:26 PM
Andrea Simone Costa
Andrea Simone Costa - avatar
29th Jul 2017, 6:58 PM
Garikai
Garikai - avatar
+ 2
yes weird translater...may egg timer is better
29th Jul 2017, 7:18 PM
Andrea Simone Costa
Andrea Simone Costa - avatar
2nd Aug 2017, 9:08 PM
Baptiste E. Prunier
Baptiste E. Prunier - avatar
0
You lost me on what an hour glass is 😅 ... okay, I think I get it
29th Jul 2017, 5:40 PM
Garikai
Garikai - avatar