题解 | #求最大连续bit数#
求最大连续bit数
http://www.nowcoder.com/practice/4b1658fd8ffb4217bc3b7e85a38cfaf2
while True:
try:
s = bin(int(input()))[2:]+'E'
t=[]
max_num=0
for i in range(len(s)):
if s[i]=='1':
num=0
for j in range(i,len(s)):
if s[j]=='1':
num+=1
else:
if num > max_num:
max_num=num
break
print(max_num)
except:
break