#include<stdio.h>
int f(int n)
{
int s;
if(n==1)
s=0;
else if(n==2)
s=1;
else if(n%2==0)
s=f(n/2)+1;
else
s=f(n-1)+1;
return s;
}
int main()
{
int num,a;
scanf("%d\n",&num);
while(num--)
{
//int a;
scanf("%d",&a);
printf("%d\n",f(a));
}
}
时间: 2024-10-09 17:57:59