import java.io.InputStream;
import java.io.OutputStreamWriter;
import java.io.PrintStream;
import java.io.PrintWriter;
import java.util.Locale;
import java.util.Scanner;
public class tas {
public static Scanner in;
public static PrintWriter out;
public static void setInput(InputStream in) {
tas.in = new Scanner(in);
}
public static void setOutput(PrintStream out) {
tas.out = new PrintWriter(new OutputStreamWriter(out));
}
public static void main(String[] args) throws Exception {
try {
Locale.setDefault(Locale.US);
} catch (Exception e) {
}
if (in == null) {
setInput(System.in);
}
if (out == null) {
setOutput(System.out);
}
new tas().solve();
out.flush();
}
int nextInt() {
return in.nextInt();
}
String next() {
return in.next();
}
String solve(int x) {
if (x == 1) {
return "1";
}
String x2 = "(1+1)*" + solve(x / 2);
return x % 2 == 0 ? x2 : "(1+" + x2 + ")";
}
void solve() throws Exception {
int[] tab = new int[(int) Math.pow(2, nextInt())];
int t = nextInt() % 2;
for (int i = 0; i < tab.length; i++) {
tab[t == 0 ? i : tab.length - 1 - i] = nextInt();
}
for (int a : tab) {
out.print(a + " ");
}
out.println();
}
}
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 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 | import java.io.InputStream; import java.io.OutputStreamWriter; import java.io.PrintStream; import java.io.PrintWriter; import java.util.Locale; import java.util.Scanner; public class tas { public static Scanner in; public static PrintWriter out; public static void setInput(InputStream in) { tas.in = new Scanner(in); } public static void setOutput(PrintStream out) { tas.out = new PrintWriter(new OutputStreamWriter(out)); } public static void main(String[] args) throws Exception { try { Locale.setDefault(Locale.US); } catch (Exception e) { } if (in == null) { setInput(System.in); } if (out == null) { setOutput(System.out); } new tas().solve(); out.flush(); } int nextInt() { return in.nextInt(); } String next() { return in.next(); } String solve(int x) { if (x == 1) { return "1"; } String x2 = "(1+1)*" + solve(x / 2); return x % 2 == 0 ? x2 : "(1+" + x2 + ")"; } void solve() throws Exception { int[] tab = new int[(int) Math.pow(2, nextInt())]; int t = nextInt() % 2; for (int i = 0; i < tab.length; i++) { tab[t == 0 ? i : tab.length - 1 - i] = nextInt(); } for (int a : tab) { out.print(a + " "); } out.println(); } } |
English