結果

問題 No.273 回文分解
ユーザー cww
提出日時 2016-07-24 01:32:30
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 547 bytes
コンパイル時間 1,838 ms
コンパイル使用メモリ 169,100 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-12-23 13:17:55
合計ジャッジ時間 2,642 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 22 WA * 10
権限があれば一括ダウンロードができます

ソースコード

diff #

#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() )
	{
		REP2( j, i + 1, (int)S.size() + 1 )
		{
			string str;
			str = S.substr( i, j );
			string tmp = str;
			reverse( tmp.begin(), tmp.end() );
			if( str == tmp )
			{
				res = max( res, (int)str.size() );
				break;
			}           
		}
	}
	cout << res << endl;
	return 0;
}
0