Files
python/C++课程/第十四课位运算训练精讲/p164_2.cpp

11 lines
153 B
C++
Raw Normal View History

2025-08-30 18:35:01 +08:00
#include<iostream>
using namespace std;
int main()
{
int n = 0, x;
cin >> x;
for (n = 0; x != 0; x &= x - 1)
n++;
cout << n;
return 0;
}