#include<cstdio>
#include<malloc.h>
#include<algorithm>
int arr[101];
void Priarr(int a,int b){
if(a<=b)
for(int i=a;i<=b;i++){
if(i!=a)printf(" ");
printf("%d",arr[i]);
}
}
int main(){
int N,M;
scanf("%d%d",&N,&M);
for(int i=1;i<=N;i++){//从1开始存储
scanf("%d",&arr[i]);
}
M%=N;
Priarr(N-M+1,N);
if(N-M+1<N)printf(" ");
Priarr(1,N-M);
return 0;
}
【PAT】B1008 数组元素循环右移问题(20 分)
猜你喜欢
转载自www.cnblogs.com/hebust/p/9498136.html
今日推荐
周排行