#C8062. Matrix Diagonal Sums
Matrix Diagonal Sums
Matrix Diagonal Sums
Given an \( N \times N \) matrix, your task is to compute two sums: the sum of the elements on the main diagonal and the sum of the elements on the anti-diagonal. The main diagonal consists of the elements \(a_{ii}\) (where the row index equals the column index) and the anti-diagonal consists of the elements \(a_{i, N-1-i}\) (where the sum of the row and column indices is \(N-1\)). For example, in a 3x3 matrix the main diagonal is \(a_{11}, a_{22}, a_{33}\) and the anti-diagonal is \(a_{13}, a_{22}, a_{31}\). The input is provided via standard input (stdin) and the result should be printed to standard output (stdout).
inputFormat
The input starts with an integer \( n \) denoting the size of the matrix. This is followed by \( n \) lines, each containing \( n \) space-separated integers representing the rows of the matrix.
outputFormat
Print two integers separated by a space: the sum of the main diagonal and the sum of the anti-diagonal.
## sample3
1 2 3
4 5 6
7 8 9
15 15