题目名称:
PAT (Basic Level) Practise (中文)
1008. 数组元素循环右移问题 (20)
1 #include <cstdio> 2 3 int main() 4 { 5 int n,m; 6 scanf("%d%d",&n,&m); 7 m %= n; 8 m = n-m; 9 int a[n]; 10 for(int i=0;i<n;i++) 11 scanf("%d",a+i); 12 for(int i=0;i<n;i++){ 13 int k= (i+m)%n; 14 if(i==n-1) 15 printf("%d",a[k]); 16 else 17 printf("%d ",a[k]); 18 } 19 return 0; 20 }
来源:https://www.cnblogs.com/fcp1024/p/4297357.html