Kaloyankerr

03. Primary Diagonal

Sep 24th, 2020
715
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. n = int(input())
  2. matrix = []
  3.  
  4. for i in range(n):
  5.     line = list(map(int, input().split()))[:n]
  6.     matrix.append(line)
  7.  
  8. res = 0
  9. for i in range(n):
  10.     res += matrix[i][i]
  11.  
  12. print(res)
RAW Paste Data