这个过了
using namespace std;
int main() {
int t, count = 0;
cin >> t;
while (t–) {
int n;
cin >> n;
int pre = n % 2;
n /= 2;
int s = 1, max = 1;
while (n) {
int temp = n % 2;
n /= 2;
if (pre == temp)
s = 1;
else if (pre != temp)
s++;
if (s > max)
max = s;
pre = temp;
}
cout << “case #” << count++ << “:\n”;
cout << max << endl;
}
return 0;
}
case编号没有自加,t>1的所有数据都是WA……加上以后可以ac。