結果
問題 | No.273 回文分解 |
ユーザー |
![]() |
提出日時 | 2015-09-08 20:41:10 |
言語 | C++11 (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 2 ms / 2,000 ms |
コード長 | 405 bytes |
コンパイル時間 | 1,371 ms |
コンパイル使用メモリ | 160,712 KB |
実行使用メモリ | 6,948 KB |
最終ジャッジ日時 | 2024-06-25 13:29:13 |
合計ジャッジ時間 | 2,428 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 32 |
ソースコード
#include <bits/stdc++.h>using namespace std;int main() {string s;cin >> s;auto r = s;reverse(r.begin(), r.end());const int n = s.size();int res = 0;for (int i = 0; i < n; ++i) {for (int j = 1; i + j <= n && j < n; ++j) {string ss = s.substr(i, j), rr = ss;reverse(rr.begin(), rr.end());if (ss == rr) res = max(res, j);}}cout << res << endl;}