結果

問題 No.273 回文分解
ユーザー 👑 CleyL
提出日時 2020-03-01 19:30:24
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 658 bytes
コンパイル時間 444 ms
コンパイル使用メモリ 65,560 KB
実行使用メモリ 6,824 KB
最終ジャッジ日時 2024-10-13 20:47:23
合計ジャッジ時間 1,500 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1 WA * 2
other AC * 9 WA * 23
権限があれば一括ダウンロードができます

ソースコード

diff #

/*
にゃんぱすー
*/
#include <iostream>
using namespace std;
int main(){
    string s;cin>>s;
    int ans = 1;
    for(int i = 0; s.size() > i; i++){
        for(int j = 0; s.size() > i; i++){
            if(i >= j)continue;
            if(i==0 && j==s.size()-1)continue;
            //i~jが怪文か
            int ti = i;
            int tj = j;
            bool ok = true;
            while(ti < tj){
                if(s[ti] != s[tj]){
                    ok = false;
                    break;
                }
                ti++;
                tj--;
            }
            ans = max(ans,j-i+1);
        }
    }
    cout << ans << endl;
}
0