UVA-11384 Help is needed for Dexter

Input
Input consists of several lines each with N such that 1 ≤ N ≤ 1, 000, 000, 000. Input will be terminated
by end of file.
Output
For each N output L in separate lines.
Sample Input
1
2
3
Sample Output
1
2
2

 

def f(n):
    if n == 1:
        return 1
    return 1 + f(n // 2)


while 1:
    try:
        n = int(input())
        print(f(n))
    except:
        break

 

posted @ 2017-09-16 09:44  少年啦飞驰  阅读(114)  评论(0)    收藏  举报