Reverse Matrix Diagonals
Здравейте, колеги!
Имам две задачи, които мъча от дни . Едната е Crossfire - без лист, но нея ще я опитвам още, а другата е Reverse Matrix Diagonals.
На три теста ми дава Runtime error. Видях, че вече има подобна тема, но не можах да разбера съвсем кода там.
Моля, ако някой има време и може да помогне!
https://pastebin.com/EMbJs1Yw
Reverse Matrix Diagonals
You are given a matrix (2D array) of integers. You have to print the matrix diagonal but in reversed order. Print each
diagonal on a new line.
Input
On the first line, single integer the number R of rows in the matrix. On each of the next R lines, C numbers are
separated by single spaces. Note that R and C may have different values.
Output
The output should consist of R lines, each consisting of exactly C characters, separated by spaces, representing the
matrix diagonals reversed.
Constraints
All the integers will be in the range [1….1000].
Examples
Input Output
3 4
21 20 18 15
19 17 14 12
16 13 11 10
10
11 12
13 14 15
16 17 18
19 20
21