1
def dectobin(n):

    return int(bin(n)[2:])
    print(int(bin(n)[2:]))

def solution(r):

    k = dectobin(r)
    print(k)
    m = str(k)
    maxgap=0
    running=0
    for i in (0,len(m)-1):
        if m[i] == 0:
            running = running+1
        elif m[i] == 1:
            if running > maxgap:
                maxgap = running
                running = 0
    print(maxgap)

x = input("give the number")
solution(x)

输出是这样给出的

 x = input("give the number")
EOFError: EOF when reading a line. 

为什么?

4

0 回答 0