不得不说,数据史上最水
查看原帖
不得不说,数据史上最水
844213
carbon_monoxide楼主2024/1/24 22:14
#include<bits/stdc++.h>
using namespace std;
char s[4];//就是这里!!!
int cnt,maxx,js;
int main(){
    cin>>s;
    for(int i=0;i<strlen(s);i++){
        for(int j=i;j<strlen(s);j++){
            if(s[j]=='G') cnt++;
            else cnt--;
            js++;
            if(!cnt) maxx=max(maxx,js);
        }
        js=cnt=0;
    }
    cout<<maxx;
    return 0;
}

好好好,怪不得帖子里大家都说n2,n3n^2,n^3也能过,n10n^{10}的复杂度也是一点也不虚!!

请求加强数据!!!

2024/1/24 22:14
加载中...