View Code of Problem 79

#include <stdio.h>
int main(){
	int n;
	scanf("%d",&n);
	int a[n],i;
	for(i=0;i<n;i++){
		scanf("%d",&a[i]);
	}
	int m,y,j;
	scanf("%d",&m);
	y=m%n;   //y表示事实移动了多少
	int b[y];
	
	for(i=n-y;i<n;i++){
		printf("%d ",a[i]);
	} 
	for(i=0;i<n-y-1;i++){
		printf("%d ",a[i]);
	}
	printf("%d",a[i]);
}

Double click to view unformatted code.


Back to problem 79