Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #define X1_REV ((x1+1) % 2)
- #define X2_REV ((x2+1) % 2)
- #define X3_REV ((x3+1) % 2)
- #define X1 x1
- #define X2 x2
- #define X3 x3
- #define Y1_F (x1&x2) || (X1_REV&X2_REV) || (X1&X2&X3) || (X1_REV&X2_REV&X3_REV)
- #define Y2_F (x1&x2&x3)
- // --- 1
- #define Y1_F1 (1&x2) || (X1_REV&X2_REV) || (X1&X2&X3) || (X1_REV&X2_REV&X3_REV)
- // ---- end of 1
- /// ----2
- #define Y2_F2 (x1&x2&1)
- // --- end of 2
- // ----- 3
- #define Y1_F3 (x1&x2) || (X1_REV&X2_REV) || (X1&X2&X3) || (X1_REV&X2_REV&0)
- // --- 4
- #define Y1_F4 (x1&x2) || (X1_REV&X2_REV) || (X1&X2&X3) || (1)
- bool matrixResultMax[9][11] = {};
- using namespace std;
- bool x1 = 0;
- bool x2 = 0;
- bool x3 = 0;
- bool y1, y2;
- bool y1_f[5];
- bool y2_f[5];
- int tableX[9][3] = {
- {0,0,0},
- {0,0,1},
- {0,1,0},
- {0,1,1},
- {1,0,0},
- {1,0,1},
- {1,1,0},
- {1,1,1}
- };
- void new_method()
- {
- for(int i =0; i<8; i++)
- {
- x1 = tableX[i][2];
- x2 = tableX[i][1];
- x3 = tableX[i][0];
- bool y1_f0 = Y1_F;
- bool y2_f0 = Y2_F;
- matrixResultMax[i][0] = y1_f0;
- matrixResultMax[i][1] = y2_f0;
- bool y1_f1 = Y1_F;
- bool y2_f1 = Y2_F;
- matrixResultMax[i][2] = Y1_F1;
- matrixResultMax[i][3] = y2_f1;
- bool y1_f2 = Y1_F1;
- bool y2_f2 = Y2_F;
- matrixResultMax[i][4] = y1_f2;
- matrixResultMax[i][5] = Y2_F2;
- bool y1_f3 = Y1_F;
- bool y2_f3 = Y2_F;
- matrixResultMax[i][6] = Y1_F3;
- matrixResultMax[i][7] = y2_f3;
- bool y1_f4 = Y1_F;;
- bool y2_f4 = Y2_F;
- matrixResultMax[i][8] = Y1_F4;
- matrixResultMax[i][9] = y2_f4;
- }
- }
- void calc()
- {
- for(int i =0; i<8; i++)
- {
- x1 = tableX[i][2];
- x2 = tableX[i][1];
- x3 = tableX[i][0];
- bool y1_f0 = Y1_F;
- bool y2_f0 = Y2_F;
- #define x2 0
- bool y1_f1 = Y1_F;
- bool y2_f1 = Y2_F;
- #undef x2
- bool y1_f2 = Y1_F;
- #undef X3_REV
- #define X3_REV 0
- bool y2_f2 = Y2_F;
- #undef X3_REV
- #define X3_REV ((x3+1) % 2)
- #define T3_y1 0 || (x3&x2*X1_REV) || (x2 & X1_REV)
- bool y1_f3 = T3_y1;
- bool y2_f3 = Y2_F;
- #define T4_y2 1 || (X3_REV & X2_REV & x1) || (x3&x2&x1)
- bool y1_f4 = Y1_F;
- bool y2_f4 = T4_y2;
- matrixResultMax[i][0] = y1_f0;
- matrixResultMax[i][1] = y2_f0;
- matrixResultMax[i][2] = y1_f1;
- matrixResultMax[i][3] = y2_f1;
- matrixResultMax[i][4] = y1_f2;
- matrixResultMax[i][5] = y2_f2;
- matrixResultMax[i][6] = y1_f3;
- matrixResultMax[i][7] = y2_f3;
- matrixResultMax[i][8] = y1_f4;
- matrixResultMax[i][9] = y2_f4;
- // cout << x3 << x2 << x1 << " |" << y1_f0 << " " <<
- // y2_f0 << " "<< y1_f1 << " " << y2_f1 << " "<< y1_f2 << " " << y2_f2 <<
- // " "<< y1_f3 << " " << y2_f3 <<
- // " "<< y1_f4 << " " << y2_f4 << endl;
- cout << x3 << x2 << x1 << " |" << y1_f3 << " " << y2_f3 << endl;
- }
- }
- void printMatrixResult()
- {
- for(int i =0; i<=8;i++)
- {
- for(int j =0; j < 10; j++)
- {
- cout << matrixResultMax[i][j] << " ";
- }
- cout << endl;
- }
- }
- void printMatrixResultFormated()
- {
- cout << "Nachalo" << endl;
- for(int i =0; i<8;i++)
- {
- for(int j =0; j <10;)
- {
- cout << matrixResultMax[i][j] << " ";
- j+=2;
- }
- cout << endl;
- for(int k =1; k <10;)
- {
- cout << matrixResultMax[i][k] << " ";
- k+=2;
- }
- cout << endl;
- cout << endl;
- }
- cout << "krai" << endl;
- }
- int main()
- {
- new_method();
- printMatrixResult();
- printMatrixResultFormated();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement