int func(x)
{
int count = 0;
while(x)
{
count++;
x = x&(x-1);
}
return count;
}
例:输入为2015 (11111011111),输出的count为10
int func(x)
{
int count = 0;
while(x)
{
count++;
x = x&(x-1);
}
return count;
}
例:输入为2015 (11111011111),输出的count为10