Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
134310 林睿 矩阵转置 C++ Compile Error 0 MS 0 KB 447 2025-10-26 17:13:48

Tests(0/0):


Code:

#include<bits/stdc++.h> using namespace std; int main(){ int a[n][m],b[m][n]; cin>>n; cin>>m; for(int i=0;i<n;i++){ for(int j=0;j<m;j++){ cin>>a[i][j]; } } for(int i=0;i<m;i++){ for(int j=0;j<n;j++){ b[i][j]=a[j][i]; } } for(int i=0;i<m;i++){ for(int j=0;j<n;j++){ cout<<b[i][j]<<" "; } cout<<" "<<endl; } }


Run Info:

Main.cc: In function 'int main()':
Main.cc:4:11: error: 'n' was not declared in this scope
     int a[n][m],b[m][n];
           ^
Main.cc:4:14: error: 'm' was not declared in this scope
     int a[n][m],b[m][n];
              ^
Main.cc:9:18: error: 'a' was not declared in this scope
             cin>>a[i][j];
                  ^
Main.cc:14:13: error: 'b' was not declared in this scope
             b[i][j]=a[j][i];
             ^
Main.cc:14:21: error: 'a' was not declared in this scope
             b[i][j]=a[j][i];
                     ^
Main.cc:19:19: error: 'b' was not declared in this scope
             cout<