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
原文地址:https://www.cnblogs.com/wangsong/p/7530148.html