题解 | #求最大连续bit数#
求最大连续bit数
https://www.nowcoder.com/practice/4b1658fd8ffb4217bc3b7e85a38cfaf2
#include <stdio.h> int main() { int max=0; int n=0; scanf("%d",&n); int count=0; while(n!=0) { if(n&1) { count++; if(max<count) max=count; } else { count=0; } n=n/2; } printf("%d\n",max); return 0; }