/*
有n个正数,使得前面每个数依次后移m个位置,最后m个数变成最前面m个数
*/
#include <stdio.h>
#include <stdlib.h>
#define N 10
void reverse(int a[],int left,int right)
{
int i,j,temp;
for(i = left,j = right ;i < j;i++,j--)
{
temp = a[i];
a[i] = a[j];
a[j] = temp;
}
}
void printArra(int arra[],int length)
{
int i;
for(i = 0;i < length;i++)
printf("%d ",arra[i]);
printf("\n");
}
int main()
{
int arra[N] = {1,2,3,4,5,6,7,8,9,10};
int m;
scanf("%d", &m);
printArra(arra,N);
m %= N;
reverse(arra,0,N - m - 1);
reverse(arra,N - m,N - 1);
reverse(arra,0,N - 1);
printf("Done:");
printArra(arra,N);
return 0;
}