import java.util.Scanner; class tas { public static void main(String args[]) { Scanner keyboard = new Scanner(System.in); int n = keyboard.nextInt(); int t = keyboard.nextInt(); int square = (int)Math.pow(2,2); int [] a = new int[square]; for (int i = 0; i < square; i++) { a[i] = keyboard.nextInt(); } if(t % 2 == 0){ for(int i= 0; i< square; i++){ System.out.print(a[i]+" "); } }else{ for(int i= square-1; i>=0 ; i--){ System.out.print(a[i]+" "); } } System.exit(0); } }
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 | import java.util.Scanner; class tas { public static void main(String args[]) { Scanner keyboard = new Scanner(System.in); int n = keyboard.nextInt(); int t = keyboard.nextInt(); int square = (int)Math.pow(2,2); int [] a = new int[square]; for (int i = 0; i < square; i++) { a[i] = keyboard.nextInt(); } if(t % 2 == 0){ for(int i= 0; i< square; i++){ System.out.print(a[i]+" "); } }else{ for(int i= square-1; i>=0 ; i--){ System.out.print(a[i]+" "); } } System.exit(0); } } |