题解 | #求最大连续bit数#
求最大连续bit数
http://www.nowcoder.com/practice/4b1658fd8ffb4217bc3b7e85a38cfaf2
def func(x):
y = bin(x)
for i in range(len(y),0,-1):
n = ''.join(['1'] * i)
if n in y:
return i
return 0
while True:
try:
a = int(input())
b = func(a)
print(b)
except:
break