302. Diagonal Difference
EasyMatrix
Print the absolute difference between the sums of the two diagonals of the square matrix.
Input format
Line 1: n n Next n lines: n integers
Output format
The absolute difference.
Example 1
Input
3 3 11 2 4 4 5 6 10 8 -12
Output
15
Example 2
Input
1 1 5
Output
0
Constraints
1 ≤ n ≤ 500
Read input from standard input and print the answer to standard output. Your code is judged against 5 test cases, most of them hidden.
Loading the MyLoginn IDE…