You are on page 1of 1

#include <stdlib.

h>
#include <stdio.h>

int main ()
{
int n=0, d=0, temp=0;
unsigned char j=0, i=0;

get:scanf("%d %d \n", &n, &d);


if( !((n>=1)&&(n<=100000)) ) goto get;
if( !((d>=1)&&(d<=n)) ) goto get;

int *Ary = malloc((sizeof(int)) * n);

for(i=0; i<n ;i++)


{
inarr:scanf("%d",&(Ary[i]));
if( !((Ary[i]>=1)&&(Ary[i]<=1000000)) ) goto inarr;
}

for(j=0; j<d ;j++)


{
temp=Ary[0];
for(i=0; i<n ;i++)
{
Ary[i]=Ary[i+1];
}
Ary[n-1]=temp;
}

for(i=0; i<n ;i++)


{
printf("%d ",Ary[i]);
}

return 0;
}

You might also like