結果
問題 |
No.588 空白と回文
|
ユーザー |
![]() |
提出日時 | 2017-11-03 22:31:47 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 422 bytes |
コンパイル時間 | 475 ms |
コンパイル使用メモリ | 60,888 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-11-22 15:56:23 |
合計ジャッジ時間 | 1,308 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 16 WA * 9 |
ソースコード
#include <iostream> #include <vector> #include <algorithm> #include <string> using namespace std; int solve(string S, int i) { int ans = 1; for (int j = 1;; j++) { if (i - j < 0 || i + j >= S.size())break; if (S[i - j] == S[i + j])ans += 2; } return ans; } int main() { string S; cin >> S; int ans = 1; for(int i=0;i<S.size();i++){ ans = max(ans, solve(S, i)); } cout << ans << endl; return 0; }