Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
155317 杜禹轩 矩阵对角线 C++ Compile Error 0 MS 0 KB 3096 2026-06-06 15:29:13

Tests(0/0):


Code:

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


Run Info:

Main.cc: In function 'int main()':
Main.cc:14:27: warning: format '%d' expects argument of type 'int', but argument 2 has type 'long long int' [-Wformat=]
     printf("%5d",a[j][i]+m);
                           ^
Main.cc:15:5: error: expected '}' before 'else'
     else printf("%5d",a[j][i]);
     ^
Main.cc:15:30: warning: format '%d' expects argument of type 'int', but argument 2 has type 'long long int' [-Wformat=]
     else printf("%5d",a[j][i]);
                              ^
Main.cc: At global scope:
Main.cc:22:2: error: expected unqualified-id before 'return'
  return 0;
  ^
Main.cc:23:1: error: expected declaration before '}' token
 }
 ^