题解 | 二进制数1
二进制数1
https://www.nowcoder.com/practice/bc4c7936f5ed42cbb9131b6f39aa272b
#include <iostream>
using namespace std;
int main()
{
long long x;cin>>x;
int count=0;
while(x)
{
count++;
x&=(x-1);//每次移除最低位的1
}
cout<<count<<endl;
return 0;
}

