Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
155323 王培臻 矩阵对角线 C++ Accepted 8 MS 760 KB 385 2026-06-06 15:30:42

Tests(10/10):


Code:

#include<bits/stdc++.h> using namespace std; int main() { long long a[1001][1001]; long long s,d; cin>>s>>d; for(int i=1;i<=s;i++){ for(int j=1;j<=s;j++){ cin>>a[i][j]; } } for(int j=1;j<=s;j++){ for(int i=1;i<=s;i++){ if(i==j||i+j==s+1){ printf("%5d",a[j][i]+d); }else{ printf("%5d",a[j][i]); } } cout<<endl; } return 0; }