【C语言代码】
#include<stdio.h>
int main() {
int N , M, i, tmp;
scanf("%d%d", &N ,&M);
int arr[N];
for(i=0; i<N; i++){
tmp=i+M;
if(tmp>=N){
tmp=tmp%N;//巧妙利用%
}
scanf("%d", &arr[tmp]);
}
for(i=0; i<N; i++){
printf("%d", arr[i]);
if(i!=N-1)printf(" ");
}
return 0;
}
最后
以上就是任性纸鹤最近收集整理的关于7-52 数组元素循环右移问题(20 point(s))的全部内容,更多相关7-52内容请搜索靠谱客的其他文章。
本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
发表评论 取消回复