Advertisement
Guest User

Untitled

a guest
Jul 22nd, 2017
58
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.73 KB | None | 0 0
  1. import java.io.*;
  2. import java.util.*;
  3. import java.text.*;
  4. import java.math.*;
  5. import java.util.regex.*;
  6.  
  7. public class Solution {
  8.  
  9. public static void main(String[] args) {
  10. Scanner in = new Scanner(System.in);
  11. int n = in.nextInt();
  12. int k = in.nextInt();
  13. int a[] = new int[n];
  14. int temp, temp2;
  15. for(int a_i=0; a_i < n; a_i++){
  16. a[a_i] = in.nextInt();
  17. }
  18. for(int index = 0; index <k; index++){
  19. for(int i = n-1; i >= 0; i--){
  20. temp=a[i];
  21. a[i]=a[n-1];
  22. a[n-1]=temp;
  23.  
  24. }
  25.  
  26. }
  27. for(int A = 0; A < n;A++){
  28. System.out.print(a[A]+ " ");
  29. }
  30. System.out.println();
  31. }
  32. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement