http://202.197.224.59/OnlineJudge2/index.php/Problem/read/id/1160

#include<iostream>
#include<stdio.h>
#include<cstring>
#include<algorithm>
using namespace std;

int main( )
{
   int T,res; long long N;
   scanf("%d",&T);
   while( T-- )
   {
       scanf("%I64d",&N); res = 0;
       while( N )
       {
           if( N%2 )res++;
           if( N == 1 )break;
           res++;
           N/=2;
       }
       printf("%d\n",res);
   }
}

相关文章:

  • 2021-11-19
  • 2021-06-18
  • 2022-12-23
  • 2022-02-24
  • 2022-01-04
  • 2022-12-23
  • 2021-08-30
  • 2022-02-06
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-09-08
  • 2022-12-23
  • 2022-02-07
  • 2019-09-15
相关资源
相似解决方案