var n,r,a,d:longint; t:array[1..1048576] of longint; begin readln(n,r); d:=1; for a:=1 to n do d:=d*2; for a:=1 to d do read(t[a]); if r mod 2 = 1 then begin for a:=d downto 1 do write(t[a],' '); end else begin for a:=1 to d do write(t[a],' '); end; end.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | var n,r,a,d:longint; t:array[1..1048576] of longint; begin readln(n,r); d:=1; for a:=1 to n do d:=d*2; for a:=1 to d do read(t[a]); if r mod 2 = 1 then begin for a:=d downto 1 do write(t[a],' '); end else begin for a:=1 to d do write(t[a],' '); end; end. |