题目描述
Calculate the sum of the diagonal elements of a 3 × 3 matrix.
输入
A matrix.
输出
Sum of main diagonal and subdiagonal elements.
样例输入 Copy
1 2 3
1 1 1
3 2 1
样例输出 Copy
3 7
list1=[]
for i in range(3):
list1.append(list(map(int,input().rstrip().split())))
print(list1[0][0]+list1[1][1]+list1[2][2],end=' ')
print(list1[0][2]+list1[1][1]+list1[2][0],end=' ')