Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- int main(){
- int n, m, i, j;
- scanf("%d",&n);
- int a[n], b[n];
- for(i=0;i<n;i++){
- scanf("%d", &a[i]);
- }
- scanf("%d", &m);
- m%=n;
- if(m<0){
- m+=n;
- }
- for(i=0;i<n;i++){
- int index=(i+m)%n;
- b[index]=a[i];
- }
- for(i=0;i<n;i++){
- printf("%d ",b[i]);
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement