結果

問題 No.273 回文分解
ユーザー kroton
提出日時 2016-07-24 22:39:01
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 538 bytes
コンパイル時間 744 ms
コンパイル使用メモリ 69,996 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-06-25 13:38:50
合計ジャッジ時間 1,549 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 32
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <cstdio>
#include <cstring>
#include <cassert>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <algorithm>
using namespace std;
typedef long long ll;

int main(){
  string S;
  cin >> S;

  int res = 1;
  for(int i=0;i<S.size();i++){
    for(int j=i;j<S.size();j++){
      string cut = S.substr(i, j - i + 1);
      if(cut == string(cut.rbegin(), cut.rend()) && cut.size() != S.size()){
        res = max(res, (int)cut.size());
      }
    }
  }
  cout << res << endl;
  return 0;
}
0