RT,我用GNU C++20 (64)就能过,但是用GNU C++17或者GNU C++14连样例都对不上,有没有大佬知道是为啥/kk
代码如下
#include<bits/stdc++.h>
using namespace std;
const int MAXN = 100010,INF = 0x3f3f3f3f;
const double eps = 0.0001;
int T,n,ans;
string s;
int main(){
cin>>T;
while(T--){
ans = INF;
cin>>s;
for(int i=0;i<26;i++){
int cnt = 0,now = 0;
for(int j=0;j<s.length();j++){
if(s[j]-'a'==i){
cnt = 0;
}
else cnt++;
if(cnt) now = max(now,(int)(log(cnt)/log(2))+1);
}
ans = min(ans,now);
}
cout<<ans<<endl;
}
}