Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.IO;
- using System.Linq;
- class Solution {
- static void Main(String[] args) {
- int sumOne = 0;
- int sumTwo = 0;
- int n = Convert.ToInt32(Console.ReadLine());
- int[][] a = new int[n][];
- for(int a_i = 0; a_i < n; a_i++){
- string[] a_temp = Console.ReadLine().Split(' ');
- a[a_i] = Array.ConvertAll(a_temp,Int32.Parse);
- }
- for(int i = 0; i < n; i++)
- {
- sumOne+=a[i][i];
- int ix = n;
- if(i == 0)
- ix--;
- else
- ix = ix - (i + 1);
- sumTwo+=a[i][ix];
- }
- int diffTotal = 0;
- diffTotal = (sumOne - sumTwo);
- if (diffTotal < 0)
- diffTotal*=-1;
- Console.WriteLine(diffTotal);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement