Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
71635 胡海峰老师 矩阵对角线 Python3 Presentation Error 45 MS 4856 KB 298 2024-04-27 10:30:05

Tests(0/10):


Code:

n,num = map(int,input().split()) #n阶方阵 a =[] for x in range(n): b = list( map(int,input().split()) ) a.append(b) for i in range(n):#row 行 for j in range(n):#column 列 if i==j or i+j ==n-1: a[i][j] = a[i][j]+ num for row in a: print(*row)