結果
問題 | No.588 空白と回文 |
ユーザー |
|
提出日時 | 2017-11-13 21:48:02 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 4 ms / 2,000 ms |
コード長 | 855 bytes |
コンパイル時間 | 1,148 ms |
コンパイル使用メモリ | 101,216 KB |
実行使用メモリ | 6,820 KB |
最終ジャッジ日時 | 2024-11-25 00:31:39 |
合計ジャッジ時間 | 2,032 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 25 |
ソースコード
#define _USE_MATH_DEFINES #include <cstdio> #include <iostream> #include <sstream> #include <fstream> #include <iomanip> #include <algorithm> #include <cmath> #include <complex> #include <string> #include <vector> #include <list> #include <queue> #include <stack> #include <set> #include <map> #include <bitset> #include <numeric> #include <limits> #include <climits> #include <cfloat> #include <functional> #include <iterator> using namespace std; int main() { string s; cin >> s; int n = s.size(); int ans = 0; for(int i=0; i<2*n-1; ++i){ int a = i / 2; int b = (i + 1) / 2; int len = b - a - 1; while(0 <= a && b < n){ if(s[a] == s[b]) len += 2; -- a; ++ b; } ans = max(ans, len); } cout << ans << endl; return 0; }