Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
121284 谭思宸 矩阵右移动 C++ Compile Error 0 MS 0 KB 598 2025-06-07 10:48:12

Tests(0/0):


Code:

#include<iostream> using nnamespace std; int main(){ int n,m; cin>>m>>n; int matrix[n][n]; int afterMatrix[n][n]; for(int i=0;i<n;i++){ for(int j=0;j<n;j++){ cin>>matrix[i][j]; } } for(int i=0;i<n;i++){ for(int j=0;j<n;j++){ int steps=(j+m)%n; afterMatrix[i][steps]=matrix[i][j]; } } for(int i=0;i<n;i++){ for(int j=0;j<n;j++){ cout<<afterMatrix[i][j] <<" "; } if(i!=n-1){ cout << endl; } } return 0;


Run Info:

Main.cc:2:7: error: expected nested-name-specifier before 'nnamespace'
 using nnamespace std;
       ^
Main.cc: In function 'int main()':
Main.cc:5:5: error: 'cin' was not declared in this scope
     cin>>m>>n; 
     ^
Main.cc:5:5: note: suggested alternative:
In file included from Main.cc:1:0:
/usr/include/c++/5/iostream:60:18: note:   'std::cin'
   extern istream cin;  /// Linked to standard input
                  ^
Main.cc:21:8: error: 'cout' was not declared in this scope
        cout<& __os)
     ^
Main.cc:27:13: error: expected '}' at end of input
     return 0;
             ^