結果

問題 No.273 回文分解
ユーザー cureskol
提出日時 2020-04-15 00:05:32
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 361 bytes
コンパイル時間 1,779 ms
コンパイル使用メモリ 168,396 KB
実行使用メモリ 6,824 KB
最終ジャッジ日時 2024-10-01 18:26:48
合計ジャッジ時間 2,973 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2 WA * 1
other AC * 27 WA * 5
権限があれば一括ダウンロードができます

ソースコード

diff #

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

template<typename T>
void chmax(T &a,T b){
  if(a<b)a=b;
}

signed main(){
  string s;cin>>s;
  int ans=0;
  for(int i=0;i<s.size();i++){
    for(int j=0;i+j<s.size();j++){
      string t=s.substr(i,j);
      string u=t;
      reverse(t.begin(),t.end());
      if(t==u)chmax(ans,j);
    }
  }
  cout<<ans<<endl;
}
0