Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
7948 邓小龙 矩阵右移动 C++ Accepted 0 MS 256 KB 626 2025-05-31 10:28:49

Tests(2/2):


Code:

#include<iostream> // cin\cout\endl #include<cstdio> //scanf()\printf() #include<cstring> // strcpy()\strcat()\strcmp()\strlen()\memset() #include<cmath> //sqrt()\pow()\abs()\ceil()\floor()\max()\min() #include<iomanip> using namespace std; int main(){ int n,m,a[7][7]; cin>>m>>n; for(int i=0;i<n;i++){ for(int j=0;j<n;j++){ int k=(j+m)%n;//1+2=3,3%3=0 //if(k==0) k=n; cin>>a[i][k]; } } for(int i=0;i<n;i++){ for(int j=0;j<n;j++){ cout<<a[i][j]<<" "; } cout<<endl; } return 0; }