結果

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

ソースコード

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