Skip to content

Latest commit

 

History

History

Diagonal Difference

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 

Diagonal Difference

Find the difference between sum of diagonals of square matrix


Given a square matrix of size , calculate the absolute difference between the sums of its diagonals.

Input Format
The first line contains a single integer, . The next lines denote the matrix's rows, with each line containing space-separated integers describing the columns.

Output Format
Print the absolute difference between the two sums of the matrix's diagonals as a single integer.

Sample Input
3
11 2 4
4 5 6
10 8 -12

Sample Output
15