General idea: shr bits one by one and see if the dropped bit was 0 or 1
total_b = 0
x = y
while (x > 0)
x = y >> 1 # shift one bit to the right
b = 0
if (y - 2*x == 0)
b = 0
else
b = 1
if b = 1
total_b++
Why is a manhole round?
Il y a 12 ans
Aucun commentaire:
Enregistrer un commentaire