結果
| 問題 |
No.273 回文分解
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2019-08-10 23:06:03 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 2,000 ms |
| コード長 | 474 bytes |
| コンパイル時間 | 2,031 ms |
| コンパイル使用メモリ | 194,376 KB |
| 最終ジャッジ日時 | 2025-01-07 11:40:47 |
|
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 32 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
bool ispali(string s, int l, int r) {
while (l<r) {
if (s[l]!=s[r]) return false;
l++,r--;
}
return true;
}
int main() {
string s;
cin>>s;
int mx=1;
for (int i=0;i<s.size();i++)
for (int j=i+1;j<s.size();j++) {
if (i==0&&j==s.size()-1) continue;
if (ispali(s,i,j)) mx=max(mx,j-i+1);
}
cout<<mx<<endl;
return 0;
}