Binary XOR or operation of the binary number of the 1 number of parity, that is to say there are three cases, 1. A binary number with an odd number of 1 and a binary number with an odd number of 1. 2. A binary number with an odd number of 1 and a binary number with an even number of 1. 3. A binary number with an even number of 1 and a binary number with an even number of 1.
Assuming that the total digit is W, the number one has x 0, the number two owns Y 0, and the number one 0 matches the number two of K 1 (k<=x).
Because the XOR or operation produces 1 only in two cases: the number of 0 and the number two of 1, the number of 1 and two of 0.
Number of the first case 1: K.
The second Case 1 number: The number one 0 and the number two 0 matches the number is x-k, this does not produce 1, then 1 's number should be: Y (x-k)
So the total number of 1 is: k+y-(x-k) =2*k+y-x
This can be discussed in three different situations:
1. A binary number with an odd number of 1 and a binary number with an odd number of 1: w is an even digit, so the x,y is odd, at which point the y-x result is even.
2. A binary number with an odd number of 1 and a binary number with an even number of 1: ibid., at this point x is odd, y is even, and the y-x result is odd.
3. A binary number with an even number of 1 and a binary number with an even number of 1: x is even, y is even, y-x is even or 0.