3 4 6 7
1 2 3
#include<stdio.h>
int main()
{
int m,N,count ;
scanf("%d",&N);
while(N--)
{
count=0;
scanf("%d",&m);
while(m!=0)
{
if(m%2==1) count++;
m=m/2;
}
printf("%d\n",count);
}
return 0;
}
原文:http://www.cnblogs.com/2014acm/p/3901459.html