카테고리 없음

answer

루트노드 2015. 3. 16. 15:00

57 chars

return (N<2)?0:helloWorld((N+1)/2)+1;


return (int)Math.ceil(Math.log(N)/Math.log(2));


return (N==1)?0:(int)(Math.log(N-1)/Math.log(2))+1;


55 chars

int helloWorld(int N) {
return (++N<3)?0:helloWorld(N/2)+1;
}

55 chars

int c;
int helloWorld(int N){
  for (N--;N>0;c++)
    N/=2;
  return c;
}


56 chars

int c,m=1;
int helloWorld(int N){
  for (;N>m;m*=2)c++;
  return c;
}


    N   paste count

    1   0
    2   1
    3   2
    5   3
    9   4
   17   5
   33   6
   65   7
  129   8
  257   9
  513  10
 1025  11
 2049  12
 4097  13
 8193  14