Run ID:121284

提交时间:2025-06-07 10:48:12

#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;