题解 | #有趣的二进制#
有趣的二进制
https://ac.nowcoder.com/acm/problem/15942
#include<bits/stdc++.h>
using namespace std;
int main ()
{
unsigned long long n;
while (cin>>n) {
int ans = 0;
while (n) {
if (n % 2 == 1) ans++;
n /= 2;
}
printf("%d\n", ans);
}
return 0;
}