剑指offer python版 二进制中1的个数 def aa (n): if not n: return False ret=0 while n: ret +=1 n=n&n-1 return ret print(aa(38))