标签:
1 #include<stdio.h>//最少乘法次数(46) 2 int main() 3 { 4 int i,x,m; 5 scanf("%d",&x); 6 while(x--){ 7 scanf("%d",&m); 8 i=0; 9 while(m!=1){ 10 if(m%2==1){ 11 i+=2; 12 } 13 else i+=1; 14 m/=2; 15 } 16 printf("%d\n",i); 17 } 18 return 0; 19 }
标签:
原文地址:http://www.cnblogs.com/minimalism/p/4537629.html