Advertisement
Jako81624

There is no God Summer

Sep 7th, 2017
122
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.91 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.IO;
  4. using System.Linq;
  5. class Solution {
  6.  
  7. static void Main(String[] args) {
  8. int sumOne = 0;
  9. int sumTwo = 0;
  10. int n = Convert.ToInt32(Console.ReadLine());
  11. int[][] a = new int[n][];
  12. for(int a_i = 0; a_i < n; a_i++){
  13. string[] a_temp = Console.ReadLine().Split(' ');
  14. a[a_i] = Array.ConvertAll(a_temp,Int32.Parse);
  15. }
  16.  
  17. for(int i = 0; i < n; i++)
  18. {
  19. sumOne+=a[i][i];
  20. int ix = n;
  21. if(i == 0)
  22. ix--;
  23. else
  24. ix = ix - (i + 1);
  25.  
  26. sumTwo+=a[i][ix];
  27. }
  28.  
  29. int diffTotal = 0;
  30.  
  31. diffTotal = (sumOne - sumTwo);
  32.  
  33. if (diffTotal < 0)
  34. diffTotal*=-1;
  35.  
  36. Console.WriteLine(diffTotal);
  37. }
  38. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement