結果
| 問題 |
No.273 回文分解
|
| コンテスト | |
| ユーザー |
ikd
|
| 提出日時 | 2016-07-23 02:32:46 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 487 bytes |
| コンパイル時間 | 724 ms |
| コンパイル使用メモリ | 56,160 KB |
| 実行使用メモリ | 5,248 KB |
| 最終ジャッジ日時 | 2024-12-23 13:17:41 |
| 合計ジャッジ時間 | 2,054 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 29 WA * 3 |
ソースコード
#include<iostream>
#include<string>
using namespace std;
bool kai(string s){
for(int i=0; i<s.size()/2; i++){
if(s[i]!=s[s.size()-1-i]) return false;
}
return true;
}
int main(){
string S;
cin>> S;
int ans=1;
for(int i=0; i<S.size(); i++){
for(int j=i+1; j<S.size(); j++){
if(kai(S.substr(i, j-i+1))) ans=max(ans, j-i+1);
}
}
if(ans==S.size()) cout<< 1;
else cout<< ans;
cout<< endl;
return 0;
}
ikd