请求加强数据

P2697 宝石串

hahazhou @ 2020-10-06 11:32:00

#include<bits/stdc++.h>
using namespace std;

int main()
{
    int sx=0;
    string s;
    cin>>s;
    int n=s.size();
    for(int i=0;i<n;i++)
    {
        for(int j=i;j<n;j++)
        {
            int N=0;
            int s1=j-i+1;
            if(s1%2==1)continue;
            for(int k=i;k<=j;k++)
            {
                if(s[k]=='G')N++;
            }
            if(N==s1/2)
            {
                sx=max(sx,s1);
            }
        }
    }
    cout<<sx;
    return 0;
}
$o(n^2)$也可以过。。。 太水了

by hahazhou @ 2020-10-06 11:32:13

@chen_zhe


by Velix @ 2020-10-06 11:33:06

真·立方过百万


by hahazhou @ 2020-10-06 11:33:43

o(n^3)通过纪录


by cmll02 @ 2020-10-06 11:40:39

@hahazhou 暴力吸氧之后甚至能排上最优解第二页


by hahazhou @ 2020-10-06 11:41:59

@shygo_cmll02 太水了 真·立方过百万


by hensier @ 2020-10-06 12:06:12

@hahazhou 最后一个测试点 n = 240


by hahazhou @ 2020-10-06 12:17:42

@shenyouran 对啊,可以过得


by hahazhou @ 2021-02-03 18:27:03

@chen_zhe


by hahazhou @ 2022-02-14 16:34:24

@StudyingFather


by hahazhou @ 2022-07-19 10:17:36

@chen_zhe

来看看吧,谢谢


|