Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
69050 胡海峰老师 外围元素之和 Python3 Accepted 33 MS 3780 KB 463 2024-03-30 12:24:28

Tests(10/10):


Code:

row,col = input().split() #5,4 --->'5', '4' row =int(row) # 行 col = int(col) #列 a=[] for i in range(row): tmp = input().split() tmp = [ int(x) for x in tmp] a.append(tmp) #数据输入完成了! res =0 for i in range(row): #i是行号 for j in range(col): #j是列号 a[i][j] if i==0 or i==row-1 : res = res + a[i][j] elif j==0 or j == col-1: res = res + a[i][j] print(res)