1 #include <stdio.h> 2 void ReguleSort(int a[],int n,int m,int *p[]) { 3 int i,j,t[100]; 4 for (i = n - m, j = 0; j < m; j++, i++) 5 t[j] = a[i]; 6 for (i = n - m - 1; i >= 0; i--) 7 a[i + m] = a[i]; 8 for (i = 0; i < m; i++) 9 a[i] = t[i]; 10 for (i = 0; i < n; i++) 11 p[i] = &a[i]; 12 13 14 } 15 16 int main() { 17 int a[100], n, m, *pa[100], i; 18 scanf("%d", &n); 19 for (i = 0; i < n; i++) { scanf("%d", &a[i]); pa[i] = &a[i]; } 20 scanf("%d",&m); 21 ReguleSort(a,n, m, pa); 22 23 for (i = 0; i < n; i++) 24 printf("%d ", *pa[i]); 25 }