mirror of
https://github.com/Kiritow/OJ-Problems-Source.git
synced 2024-03-22 13:11:29 +08:00
34806a93cd
2500-2599
26 lines
420 B
C++
26 lines
420 B
C++
#include<stdio.h>
|
|
int main()
|
|
{
|
|
int C;
|
|
scanf("%d",&C);
|
|
while(C--)
|
|
{
|
|
int n,k=0;
|
|
scanf("%d",&n);
|
|
while(n!=0)
|
|
{
|
|
while(n%2==0)
|
|
{
|
|
n=n/2;
|
|
}
|
|
while(n%2!=0)
|
|
{
|
|
n--;
|
|
k++;
|
|
}
|
|
}
|
|
printf("%d\n",k);
|
|
}
|
|
return 0;
|
|
}
|