#include <iostream>
using namespace std;
int func (int x)
{
int count = 0;
while (x)
{
count ++;
x = x&(x-1);
}
return count;
}
判断二进制数1的个数
最新推荐文章于 2023-03-24 10:32:48 发布
#include <iostream>
using namespace std;
int func (int x)
{
int count = 0;
while (x)
{
count ++;
x = x&(x-1);
}
return count;
}