#CCBCHBAHAI0000072. Dịch vòng phải d bước bằng mảng phụ (Right Rotate by d Using an Auxiliary Array)
Dịch vòng phải d bước bằng mảng phụ (Right Rotate by d Using an Auxiliary Array)
Right Rotate by d Using an Auxiliary Array (Dịch vòng phải d bước bằng mảng phụ)
Source: Phước Hưng OJ
Version: Phuoc Hung OJ Extended
Problem
Given and a non-negative integer , let
After a right rotation by positions,
Construct using an auxiliary array and print it.
Input
The first line contains and . The second line contains integers .
Output
Print the array after the right rotation.
Subtask
Subtask 1 (20 points): , , .
Subtask 2 (30 points): , , .
Subtask 3 (50 points): , , .
Example
Input
6 8
10 20 30 40 50 60
Output
50 60 10 20 30 40
Explanation
The sample follows the mathematical definition above.