#C3650. Diagonal Difference
Diagonal Difference
Diagonal Difference
Given a square matrix, your task is to calculate the absolute difference between the sum of its primary diagonal and the sum of its secondary diagonal.
The primary diagonal is given by: $$ \sum_{i=0}^{n-1} a_{i,i} $$ and the secondary diagonal is given by: $$ \sum_{i=0}^{n-1} a_{i,n-i-1} $$.
You will be provided with T test cases. For each test case, first an integer n is given indicating the size of the square matrix, followed by n lines each containing n space-separated integers.
For each test case, output the computed absolute difference on a new line.
inputFormat
The input is read from stdin and has the following format:
- The first line contains a single integer T, the number of test cases.
- For each test case:
- The first line contains an integer n, the size of the square matrix.
- The next n lines each contain n space-separated integers representing the matrix.
outputFormat
For each test case, output a single integer — the absolute difference between the sum of the primary diagonal and the sum of the secondary diagonal. Each result should be printed on a new line to stdout.
## sample1
1
1
0
</p>