// tas.cpp : Defines the entry point for the console application.
//
// #include "stdafx.h"
#include <stdio.h>
using namespace std;
static int iN, iT, iCnt;
static int aIn[1 << 20];
static void ReadData()
{
    scanf("%d", &iN);
    scanf("%d", &iT);
    iCnt = (1 << iN);
    iT &= 1;
    for (int i = 0; i < iCnt; ++i)
    {
        int x;
        scanf("%d", &x);
        aIn[i] = x;
    }
}
static void Solve()
{
    int iMask = iCnt - 1;
    for (int i = 0; i < iCnt; ++i)
    {
        if (iT)
        {
            printf("%d ", aIn[i ^ iMask]);
        }
        else
        {
            printf("%d ", aIn[i]);
        }
    }
}
int main(int argc, char * argv[])
{
//    freopen("sample_input.txt",  "r", stdin);
//    freopen("sample_output.txt", "w", stdout);
    ReadData();
    Solve();
	return 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 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 64 65 66 | // tas.cpp : Defines the entry point for the console application. // // #include "stdafx.h" #include <stdio.h> using namespace std; static int iN, iT, iCnt; static int aIn[1 << 20]; static void ReadData() { scanf("%d", &iN); scanf("%d", &iT); iCnt = (1 << iN); iT &= 1; for (int i = 0; i < iCnt; ++i) { int x; scanf("%d", &x); aIn[i] = x; } } static void Solve() { int iMask = iCnt - 1; for (int i = 0; i < iCnt; ++i) { if (iT) { printf("%d ", aIn[i ^ iMask]); } else { printf("%d ", aIn[i]); } } } int main(int argc, char * argv[]) { // freopen("sample_input.txt", "r", stdin); // freopen("sample_output.txt", "w", stdout); ReadData(); Solve(); return 0; } | 
 
            
         English
                    English