/ch0108/03/
"""1.8编程基础之多维数组 03 计算矩阵边缘元素之和/ch0108/03/"""sum=0a = []m,n=map(int,input().split())for i in range(m):a.append(list(map(int,input().split())))for i in range(m):for j in range(n):if i==0 or i==m-1 or j==0 or j==n-1 :sum+=a[i][j]print(sum)
时间:2023-07-20 22:04:41
/ch0108/03/
"""1.8编程基础之多维数组 03 计算矩阵边缘元素之和/ch0108/03/"""sum=0a = []m,n=map(int,input().split())for i in range(m):a.append(list(map(int,input().split())))for i in range(m):for j in range(n):if i==0 or i==m-1 or j==0 or j==n-1 :sum+=a[i][j]print(sum)