#include <bits/stdc++.h>
using namespace std;
int main()
{
ios::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
int n;
cin >> n;
while (n --)
{
int x;
cin >> x;
int ans = 0;
for (int i = x; i; i -= i & -i)
{
ans ++;
}
cout << ans << ' ';
}
return 0;
}
C++位运算
最新推荐文章于 2022-10-21 16:53:28 发布