Run ID:2976

提交时间:2024-03-16 10:08:40

# include<iostream> using namespace std; int first[101][101],second[101][101]; int n,m,move; int main(){ cin>>m>>n; for(int i=0;i<n;i++){ for(int j=0;j<n;j++){ cin>>first[i][j]; } } move=m%n; for(int i=0;i<n;i++){ for(int j=0;j<n;j++){ if(j+move>=n) second[i][j+move-n]=first[i][j]; else second[i][j+move]=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; }