Run ID:2977
提交时间:2024-03-16 10:09:55
# include<iostream> using namespace std; int first[101][101],second[101][101]; int n,m,moves; int main(){ cin>>m>>n; for(int i=0;i<n;i++){ for(int j=0;j<n;j++){ cin>>first[i][j]; } } moves=m%n; for(int i=0;i<n;i++){ for(int j=0;j<n;j++){ if(j+moves>=n) second[i][j+moves-n]=first[i][j]; else second[i][j+moves]=first[i][j]; } } for(int i=0;i<n;i++){ cout<<endl; for(int j=0;j<n;j++){ cout<<second[i][j]<<" "; } } return 0; }