結果
問題 | No.588 空白と回文 |
ユーザー |
![]() |
提出日時 | 2017-11-03 23:14:07 |
言語 | C++11 (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 2 ms / 2,000 ms |
コード長 | 920 bytes |
コンパイル時間 | 738 ms |
コンパイル使用メモリ | 67,672 KB |
実行使用メモリ | 6,820 KB |
最終ジャッジ日時 | 2024-11-23 14:53:43 |
合計ジャッジ時間 | 1,513 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 25 |
ソースコード
#include <iostream>#include <stdio.h>#include <cstring>#include <math.h>#include <algorithm>#include <vector>#include <string>#include <stdlib.h>#include <queue>#include <stack>#include <utility>#define rep(i,n) for(int i=0;i<n;i++)#define rrep(i,n) for(int i=n-1;i>=0;i--)#define FOR(i,a,b) for(int i=a;i<b;i++)#define ll long long#define INF 1000000001#define mod 1000000007using namespace std;int main(){//cin.tie(0);//ios::sync_with_stdio(false);string s;cin>>s;int sl=s.size();int ans=1;rep(i,sl){int j=0;int a=1;while(1){j++;if(i-j>-1 && i+j<sl){if(s[i-j]==s[i+j]){a+=2;}}else{break;}}ans=max(ans,a);if(i==sl-1) continue;if(i+1>=sl)continue;j=-1;a=0;while(1){j++;if(i-j>-1 && i+j+1<sl){if(s[i-j]==s[i+j+1]){a+=2;}}else{break;}}ans=max(ans,a);}cout<<ans<<endl;}