试题描述
试题代码
package com.hym.PAT_B;
import java.util.Scanner;
/**
* Created by ymhou on 2016/11/14.
* 主要思路:
* 定义一个长度为2N的数组进行数组数据的复制
*
* 通过全部测试点,答案正确
*/
public class PAT_B_1008 {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
int N = scanner.nextInt();
int M = scanner.nextInt();
int num[] = new int[2*N];
for(int i=0; i<N; i++){
num[i] = scanner.nextInt();
num[N+i] = num[i];
}
M = M%N;
for(int i=0; i<N; i++){
System.out.print(num[N-M+i]);
if(i == N-1){
break;
}
System.out.print(" ");
}
}
}