-->
当前位置:首页 > 题库

PROGRAMMING:Sequence circulates right

Luz5年前 (2021-05-10)题库406
This problem requires writing a program to move each element in the array $$a $$to the right by $$M $$positions, that is, the elements in the array $$a $$are transformed from $$a [0] $, $$a [1] $, $$cdots $$, $$a [n-1] $$to the $$a [N-M] $, $$a [N-M + 1] $, $$cdots $, $$a [n-1] $, $$a [0] $, $$a [1] $, $$cdots $, $$a [n-m-1] $.
###Input format:
Enter line 1 to give $$n $$($$1 / Le n / Le 100 $$) and $$M $$($$1 / Le n / Le 100 $$), and line 2 to enter $$n $$integers separated by spaces.
###Output format:
Output the array elements after cyclic shift in one line, with a space after each element.
###Input example:
```in
3 2
1 2 3
```
###Output example:
```out
2 3 1
```







answer:If there is no answer, please comment