用中位数可证明正确性!
#include <cstdlib>
#include <iostream>
#include <stdio.h>
using namespace std;
long f(long n)
{
return n == 1? 1: f(n/2) +1;
}
int main(int argc, char *argv[])
{
long n;
while(scanf("%ld",&n) != -1)
{
printf("%ld\n",f(n));
}
//system("PAUSE");
return EXIT_SUCCESS;
}