結果

問題 No.273 回文分解
ユーザー nasadigital
提出日時 2015-08-29 02:09:07
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
TLE  
実行時間 -
コード長 478 bytes
コンパイル時間 1,334 ms
コンパイル使用メモリ 157,520 KB
実行使用メモリ 10,496 KB
最終ジャッジ日時 2024-12-23 11:54:02
合計ジャッジ時間 11,101 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 29 TLE * 3
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>

using namespace std;

string s;

bool chk(int st,int ed){
    ed--;
    while(st<ed){
        if(s[st]!=s[ed])
            return false;
        st++;
        ed--;
    }
    return true;
}

int rek(int st,bool a){
    int r=1;
    for(int ctr1=st+1;ctr1<=s.length()-a;ctr1++){
        if(chk(st,ctr1)){
            r=max(ctr1-st,max(r,rek(ctr1,false)));
        }
    }
    return r;
}

int main()
{
    cin>>s;
    cout<<rek(0,true);
    return 0;
}
0