結果
問題 | No.588 空白と回文 |
ユーザー |
![]() |
提出日時 | 2022-05-29 18:15:22 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 83 ms / 2,000 ms |
コード長 | 335 bytes |
コンパイル時間 | 1,910 ms |
コンパイル使用メモリ | 192,736 KB |
最終ジャッジ日時 | 2025-01-29 16:58:37 |
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 25 |
ソースコード
#include <bits/stdc++.h> using namespace std; #define REP(i,n) for(int i=0;i<(n);i++) int main(){ ios::sync_with_stdio(false); cin.tie(nullptr); string s;cin>>s; int ans=1; REP(i,s.size())REP(j,i){ int cnt=0; for(int k=0;j+k<i-k;k++)cnt+=s[j+k]==s[i-k]; ans=max(ans,cnt*2+((i-j)%2==0)); } cout<<ans<<endl; }