You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

20 lines
278 B

#include<bits/stdc++.h>
//https://blog.csdn.net/sandwichsauce/article/details/79847953
using namespace std;
int func(int x)
{
int count = 0;
while (x)
{
count++;
x = x&(x - 1);
}
return count;
}
int main()
{
cout << func(2048) << endl;
return 0;
}