結果
| 問題 |
No.273 回文分解
|
| コンテスト | |
| ユーザー |
hogeover30
|
| 提出日時 | 2016-07-25 01:29:13 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 455 bytes |
| コンパイル時間 | 821 ms |
| コンパイル使用メモリ | 67,700 KB |
| 実行使用メモリ | 6,824 KB |
| 最終ジャッジ日時 | 2024-12-23 13:19:13 |
| 合計ジャッジ時間 | 1,874 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 WA * 1 |
| other | AC * 27 WA * 5 |
ソースコード
#include <iostream>
#include <algorithm>
#include <string>
using namespace std;
bool isPalindrome(string s)
{
int n=s.size();
for(int i=0; i<n/2; ++i)
if (s[i]!=s[n-1-i]) return false;
return true;
}
int main()
{
string s; cin>>s;
int n=s.size();
int res=0;
for(int i=0; i<n; ++i)
for(int m=1; m<n-i; ++m)
if (isPalindrome(s.substr(i, m)) and res<m)
res=m;
cout<<res<<endl;
}
hogeover30