結果
問題 |
No.588 空白と回文
|
ユーザー |
![]() |
提出日時 | 2017-12-24 20:16:47 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 538 bytes |
コンパイル時間 | 576 ms |
コンパイル使用メモリ | 67,592 KB |
実行使用メモリ | 6,824 KB |
最終ジャッジ日時 | 2024-12-17 18:37:08 |
合計ジャッジ時間 | 1,650 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 15 WA * 10 |
ソースコード
#include <iostream> #include <vector> #include <algorithm> #include <string> #include <sstream> #include <cmath> #include <stack> using namespace std; int main() { string s; cin>>s; int left_side=0; int right_side=0; int ans =1; for(int i=1; i<s.length()-1;i++){ left_side =i; right_side =i; int tmp=0; while(left_side !=0 && right_side !=s.length()-1){ if(s[--left_side] == s[++right_side]){ tmp +=2; } } ans = max(ans,tmp); } if(ans ==1){ cout<<0<<endl; }else { cout<<ans+1<<endl; } return 0; }