直接当成无符号输入 即为补码
#include <stdio.h>
int main(){
unsigned long long n;
while(scanf("%llu", &n) != EOF){
int i = 0;
while (n){
if (n % 2 == 1)
i++;
n = n / 2;
}
printf("%d\n", i);
}
return 0;
}