int foo(x)
{
int count = 0;
while (x)
{
count++;
x = x & (x - 1);
}
return count;
}
求解一个数中含1的个数
最新推荐文章于 2019-05-25 21:50:54 发布
int foo(x)
{
int count = 0;
while (x)
{
count++;
x = x & (x - 1);
}
return count;
}