题解 | #求最大连续bit数#
求最大连续bit数
https://www.nowcoder.com/practice/4b1658fd8ffb4217bc3b7e85a38cfaf2
while True: try: x = bin(int(input()))[2:]#bin函数的返回类型是字符串类型 for i in x: if i != '1': x = x.replace(i, ' ')#注意replace需要一个变量接受替换后的字符串 x = x.split() max_l = 0 for i in x: if len(i) > max_l: max_l = len(i) print(max_l) except: break