Treat problem 5 from original manuscript
"Решение задания ЕГЭ - 18 с битовыми операциями" with Bitwise2
Follow Bitwise2 rules
(x&26 ¬=10 ) = ¬Z(16) + Z(8) + Z(2)
(x&27 = 11 ) = Z(16)*¬Z(8)*¬Z(2)*¬Z(1)
26 = 11010
10 = 01010
27 = 11011
11 = 01011
Due to
¬A + A*B = (¬A + A)*(¬A + B) = ¬A + B
A + ¬A*B = (A + ¬A)*(A + B) = A + B
After applying conversions mentioned above
We are going to obtain :-
¬Z(16) + Z(8) + Z(2) + Z(16)*¬Z(8)*¬Z(2)*¬Z(1) + A = 1
¬Z(16) + Z(8) + Z(2) + ¬Z(1) + A = 1
¬(Z(16)*Z(1)) + Z(8) + Z(2) + A = 1
Z(16 OR 1) => Z(8) + Z(2) + A = 1
(Z(17)=> A) + (Z(17)=>Z(8)) + (Z(17)=>Z(2)) = 1
Z(17) => A = 1
Thus A(max) = 17
So issue when "b1-c1=b2-c2" might be resolved
via Bitwise2 technique and Problem 5 gets resolved without any new development efforts. Also notice that in general (b-c) doesn't have to
be a basic predicate. Sample bellow has (b-c) = 36. But the multitude
of "c" bits "1" must be included in the multitude of "b" bits "1"
First notice
¬A + A*B = (¬A + A)*(¬A + B) = ¬A + B (1)
A + ¬A*B = (A + ¬A)*(A + B) = A + B (2)
and follow "Решение задания ЕГЭ - 18 с битовыми операциями"
***********************************
For instance consider equation
***********************************
(x&46 ¬= 10) v (x&47 = 11) v (x&A =0) = 1
(x&47 = 11) = ¬E(36)*E(8)*E(2)*E(1)
(x&46 ¬= 10) = E(36) + ¬E(8) + ¬E(2)
Hacking "mysterious" rules of Boolean algebra ( fragment of original
manuscript posted bellow )
According Boolean algebra rules (1),(2) :-
Per (1)
E(36) + ¬E(8) + ¬E(2) + ¬E(36)*E(8)*E(2)*E(1)+¬E(A) = 1
E(36) + ¬E(8) + ¬E(2) + ¬E(36)*E(2)*E(1) + ¬E(A) = 1
E(36) + ¬E(8) + ¬E(2) + ¬E(36)*E(1) + ¬E(A) = 1
Per (2)
E(36) + ¬E(8) + ¬E(2) + E(1) + ¬E(A) = 1
46= 101110 (binary)
10 =001010
47 =101111
11 =001011
Now we see that A(max) = 37
**************************************
Another sample done both ways
**************************************
(x&62 ¬= 26)v(x&63 = 27)v(x&A = 0) = 1
62 = 111110
26 = 011010
63 = 111111
27 = 011011
(x&63 = 27) = ¬E(36)*E(16)*E(8)*E(2)*E(1)
(x&62 ¬= 26) = E(36) + ¬E(16) + ¬E(8) + ¬E(2)
E(36) + ¬E(16) + ¬E(8) + ¬E(2) + ¬E(36)*E(16)*E(8)*E(2)*E(1) + ¬E(A) = 1
E(36) + ¬E(16) + ¬E(8) + ¬E(2) + E(1) + ¬E(A) = 1
E(37) + ¬E(16) + ¬E(8) + ¬E(2) + E(1) + ¬E(A) = 1
Thus A(max) = 37
*********************
Bitwise solution
*********************
(x&62 ¬= 26)v(x&63 = 27)v(x&A = 0) = 1
62 = 111110
26 = 011010
63 = 111111
27 = 011011
(x&63 = 27) = Z(36)*¬Z(16)*¬Z(8)*¬Z(2)*¬Z(1)
(x&62 ¬= 26) = ¬Z(36) + Z(16) + Z(8) + Z(2)
¬Z(36) + Z(16) + Z(8) + Z(2) + Z(36)*¬Z(16)*¬Z(8)*¬Z(2)*¬Z(1) + A = 1
¬Z(36) + Z(16) + Z(8) + Z(2) + ¬Z(1) + A = 1
¬(Z(36)*Z(1)) + Z(16) + Z(8) + Z(2) + A = 1
Z(37) => Z(16) + Z(8) + Z(2) + A = 1
(Z(37)=>A) + (Z(37)=>16) + (Z(37)=>Z(8)) + (Z(37)=>Z(2)) = 1
Thus A(max) = 37
********************************
Keep staying with Bitwise
********************************
(x&62 = 30)v(x&60 ¬= 28)v(x&A = 0) = 1
62 = 111110
30 = 011110
60 = 111100
28 = 011100
(x&62 = 30) = Z(32)*¬Z(16)*¬Z(8)*¬Z(4)*¬Z(2)
(x&60 ¬= 28) = ¬Z(32) + Z(16) + Z(8) + Z(4)
¬Z(32) + Z(16) + Z(8) + Z(4) + Z(32)*¬Z(16)*¬Z(8)*¬Z(4)*¬Z(2) +A = 1
¬Z(32) + Z(16) + Z(8) + Z(4) + ¬Z(2) + A = 1
¬(Z(32)*Z(2)) + Z(16) + Z(8) + Z(4) + A = 1
Z(34) => Z(16) + Z(8) + Z(4) + A = 1
(Z(34)=>Z(16)) + (Z(34)=>Z(8)) + (Z(34)=>Z(4)) + (Z(34)=>A) = 1
Z(34)=>A = 1
Thus A(max) = 34
*******************************************************
(x&120 ¬= 56) v (x&124 = 60) v (x&A=0) = 1
*******************************************************
120 = 1111000
56 = 0111000
124 = 1111100
60 = 0111100
(x&120 ¬= 56) = ¬Z(64) + Z(32) + Z(16) + Z(8)
(x&124 = 60) = Z(64)*¬Z(32)*Z(16)*¬Z(8)*¬Z(4)
(x&120 ¬= 56) v (x&124 = 60) v A =
¬Z(64) + Z(32) + Z(16) + Z(8) + Z(64)*¬Z(32)*Z(16)*¬Z(8)*¬Z(4) + A = 1
¬Z(64) + Z(32) + Z(16) + Z(8) + ¬Z(4) + A = 1
¬(Z(64)*Z(4)) + Z(32) + Z(16) + Z(8) + A = 1
¬(Z(64 OR 4)) + Z(32) + Z(16) + Z(8) + A = 1
¬Z(68) + Z(32) + Z(16) + Z(8) + A = 1
Z(68) => Z(32) + Z(16) + Z(8) + A = 1
(Z(68) => Z(32)) + (Z(68)=>Z(16)) + (Z(68)=>Z(8)) + (Z(68)=> A) = 1
Z(68) => A = 1
Thus A(max)=68
************************************************************
(x&248 ¬= 152) v (x&252 = 156) v (x&A = 0) = 1
************************************************************
252 = 11111100
156 = 10011100
248 = 11111000
152 = 10011000
(x&248 ¬= 152) = ¬Z(96) + Z(128) + Z(16) + Z(8)
(x&252 = 156) = Z(96)*¬Z(128)*¬Z(16)*¬Z(8)*¬Z(4)
¬Z(96) + Z(128) + Z(16) + Z(8) + Z(96)*¬Z(128)*¬Z(16)*¬Z(8)*¬Z(4) + A = 1
¬Z(96) + Z(128) + Z(16) + Z(8) + ¬Z(4) + A = 1
¬(Z(96)*Z(4)) + Z(128) + Z(16) + Z(8) + A = 1
Z(100) => Z(128) + Z(16) + Z(8) + A = 1
(Z(100)=>Z(128)) + (Z(100)=>Z(16)) + (Z(100)=>Z(8)) + (Z(100)=>A) = 1
Z(100) => A = 1
Thus A(max) = 100
***************************************************************************
(x&248 ¬= 152)v(x&252 = 156)v(x&250 = 154)v(x&A = 0) = 1
***************************************************************************
252 = 11111100
156 = 10011100
248 = 11111000
152 = 10011000
250 = 11111010
154 = 10011010
(x&248 ¬= 152) = ¬Z(96) + Z(128) + Z(16) + Z(8)
(x&252 = 156) = Z(96)*¬Z(128)*¬Z(16)*¬Z(8)*¬Z(4)
(x&250 = 154) = Z(96)*¬Z(128)*¬Z(16)*¬Z(8)*¬Z(2)
¬Z(96) + Z(128) + Z(16) + Z(8) + Z(64)*¬Z(128)*¬Z(16)*¬Z(8)*¬Z(4)
+ Z(96)*¬Z(128)*¬Z(16)*¬Z(8)*¬Z(2) + A = 1
¬Z(96) + Z(128) + Z(16) + Z(8) + ¬Z(4)
+ Z(96)*¬Z(128)*¬Z(16)*¬Z(8)*¬Z(2) + A = 1
¬Z(96) + Z(128) + Z(16) + Z(8) + ¬Z(4) + ¬Z(2) + A = 1
¬(Z(96)*Z(4)*Z(2)) + Z(128) + Z(16) + Z(8) + A = 1
Z(102) => Z(128) + Z(16) + Z(8) + A = 1
(Z(102)=>Z(128)) + (Z(102)=>Z(16)) + (Z(102)=>Z(8)) + (Z(102)=>A) = 1
Z(102) => A = 1
Thus A(max) = 102
No comments:
Post a Comment