| Hamming Distance |
|Time Limit: 1000ms, Special Time Limit:2500ms, Memory Limit:32768KB |
| Total submit users: 113, Accepted users: 75 |
| Problem 10011 :
No special judgement
Given a positive integer A,we can write A in binary form,and the binary form of A is called code word of A.
The Hamming Distance between two code words i and j is the number of components at which the two code words differ, and is denoted by h(i,j).
i=98 and j=70
It is clear to see that these two words differ at the 3rd and 6th positions. We can then say that they have a Hamming Distance of 2.
i: 01100010(code word)
j: 01000110(code word)
Your task is to calculate Hamming distance of two given integers.
| The input contains multiple test cases,one per line.
Each line of input contains two integers i and j (0< i , j <264). A line containing "0 0" indicates the end of input, and must not be processed.
| For each test case, output a line containing Hamming distance h(i,j).|
| HNU Contest |