結果
問題 | No.273 回文分解 |
ユーザー |
![]() |
提出日時 | 2016-07-26 22:33:06 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 2 ms / 2,000 ms |
コード長 | 542 bytes |
コンパイル時間 | 1,611 ms |
コンパイル使用メモリ | 167,748 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-06-25 13:40:20 |
合計ジャッジ時間 | 2,610 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 32 |
ソースコード
#include <bits/stdc++.h> #define REP(i,n) for(int i=0; i<(n); i++) #define REP2(i,x,n) for(int i=x; i<(n); i++) using namespace std; struct CWW{CWW(){ios::sync_with_stdio(false);cin.tie(0);}}cww; int main() { string S; cin >> S; int res{}; REP( i, (int)S.size() ) { string str; REP2( j, i, (int)S.size() ) { str += S[j]; string tmp = str; reverse( tmp.begin(), tmp.end() ); if( str == tmp && (int)str.size() != (int)S.size() ) { res = max( res, (int)str.size() ); } } } cout << res << endl; return 0; }