标签:
#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));
}
}
标签:
原文地址:http://www.cnblogs.com/mycapple-zgs-111411/p/4619468.html