class Solution { public: int NumberOf1(int n) { int x=0;//n的二进制表示中1的个数 while(n) n-=n&-n,x++;//n&-n为lowbit return x; } };