UVA11384 - Help is needed for Dexte(正整数序列)

大水题,自己在纸上算几个值就能看出规律。

代码如下:

#include <cstdio>
int fun(int n)
{
    if(n==1) return 1;
    return fun(n/2)+1;
}
int main ()
{
    int n;
    while(scanf("%d",&n)==1)
    printf("%d\n",fun(n));
    return 0;
}


posted on 2013-04-22 19:33  Primo...  阅读(120)  评论(0)    收藏  举报