import java.util.Scanner;
public class tas {
public static void main(String[] args) {
Scanner s = new Scanner(System.in);
int n = s.nextInt();
int t = s.nextInt();
int[] cards = new int[1 << n];
int odd = t & 1;
for (int i = 0; i < cards.length; i++) {
if (odd ==1 ) {
cards[cards.length - i - 1] = s.nextInt();
} else {
cards[i] = s.nextInt();
}
}
for (int i = 0; i < cards.length; i++) {
System.out.print(cards[i] + " ");
}
}
}
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 26 27 | import java.util.Scanner; public class tas { public static void main(String[] args) { Scanner s = new Scanner(System.in); int n = s.nextInt(); int t = s.nextInt(); int[] cards = new int[1 << n]; int odd = t & 1; for (int i = 0; i < cards.length; i++) { if (odd ==1 ) { cards[cards.length - i - 1] = s.nextInt(); } else { cards[i] = s.nextInt(); } } for (int i = 0; i < cards.length; i++) { System.out.print(cards[i] + " "); } } } |
English