南阳 46 最小乘法次数

来源:互联网 发布:淘宝买家申请小二介入 编辑:程序博客网 时间:2024/05/16 13:57
#include<stdio.h>int main(){    int n,t,s,i;    scanf("%d",&t);    while(t--){        scanf("%d",&n);        s=0;        while(n){            if(n&1) s++;            s++;            n/=2;        }        printf("%d\n",s-2);    }    return 0;}

0 0