Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
86958 丁俊杰 对角线之和 Python3 Accepted 41 MS 3768 KB 290 2024-07-31 01:51:18

Tests(10/10):


Code:

n=int(input()) results=[] for i in range(n): a=list(map(int,input().split())) results.append(a) res=0 for row in range(n): for col in range(n): if row==col or row+col==n-1: #主对角线和副对角线 res+=results[row][col] print(res)