Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
125546 晏莞煜 矩阵对角线 C++ Compile Error 0 MS 0 KB 523 2025-07-15 09:18:00

Tests(0/0):


Code:

#include<iostream> using namespace std; int main(){ int n,m; cin>>n>>m; int a[n][n]; for(int i=0;i<n;i++){ for(int q=0;q<n;q++){ cin>>a[i][q]; } } for(int t=0;t<n;t++){ for(int i=0;i<n;i++){ for(int q=0;q<n;q++){ if(i==q){ a[i][q]+=m; } } } for(int l=0;l<n;l++){ for(int k=n-1;k>=0;k--){ if(k==l && a[l][k]!=a[i][q]){ a[i][q]+=m; } } } } for(int i=0;i<n;i++){ for(int q=0;q<n;q++){ cout<<a[i][q]<<" "; } cout<<endl; } return 0; }


Run Info:

Main.cc: In function 'int main()':
Main.cc:22:26: error: 'i' was not declared in this scope
    if(k==l && a[l][k]!=a[i][q]){
                          ^
Main.cc:22:29: error: 'q' was not declared in this scope
    if(k==l && a[l][k]!=a[i][q]){
                             ^