結果

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

ソースコード

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;
	string str, tmp;
	int res{};
	REP( i, (int)S.size() )
	{
		str += S[i];
		REP2( j, i+1, (int)S.size() )
		{
			str += S[j];
			tmp = str;
			reverse( tmp.begin(), tmp.end() );
			if( tmp == str )
			{
				res = max( res, (int)str.size() );
				i += (int)str.size() - 1;
			}            
		}
		str.clear();
	}
	cout << ( res != 2 ? res : 1 ) << endl;
	return 0;
}
0