Last active
December 22, 2016 11:50
-
-
Save timkofu/cb4b404b1510b5f32aa7d892e3c0eaa6 to your computer and use it in GitHub Desktop.
just coz
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Given a square matrix of size N x N, calculate the absolute difference between the sums of its diagonals. | |
m_raw = input().strip() | |
m_order = int(m_raw.split("\n")[0]) | |
for _ in range(m_order): | |
m_raw += "\n"+input().strip() | |
m_trix = [list(map(int, x.strip().split())) for x in m_raw.split("\n")][1:] | |
print(abs(sum([(m_trix[x][x] - m_trix[x][-(x+1)]) for x in range(m_order)]))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment