版权声明:欢迎转载并请注明出处,谢谢~~ https://blog.csdn.net/chimomo/article/details/7716641
/*
* Created by Chimomo
*/
#include <iostream>
#define NULL 0
using namespace std;
int f(int x) {
int n = 0;
while (x) {
n++;
x &= x - 1;
}
return n;
}
int main() {
cout << f(26) << endl;
return 0;
}
// Output:
/*
3
*/