結果
| 問題 |
No.588 空白と回文
|
| コンテスト | |
| ユーザー |
hirokazu1020
|
| 提出日時 | 2017-11-03 22:38:02 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 4 ms / 2,000 ms |
| コード長 | 998 bytes |
| コンパイル時間 | 835 ms |
| コンパイル使用メモリ | 95,824 KB |
| 実行使用メモリ | 5,248 KB |
| 最終ジャッジ日時 | 2024-11-22 16:00:50 |
| 合計ジャッジ時間 | 1,459 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 25 |
ソースコード
#define _CRT_SECURE_NO_WARNINGS
#include<iostream>
#include<sstream>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<climits>
#include<cmath>
#include<string>
#include<vector>
#include<set>
#include<map>
#include<queue>
#include<numeric>
#include<functional>
#include<algorithm>
#include<bitset>
#include<tuple>
#include<unordered_set>
#include<random>
#include<array>
#include<cassert>
using namespace std;
#define INF (1<<29)
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define all(v) v.begin(),v.end()
#define uniq(v) v.erase(unique(all(v)),v.end())
int main() {
ios::sync_with_stdio(0);
cin.tie(0);
string s;
cin>>s;
int ans = 0;
rep(i,s.size()){
int t=1;
for (int j=1;i-j>=0 && i+j<s.size();j++){
if (s[i-j]==s[i+j]){
t+=2;
}
}
ans = max(ans,t);
}
rep(i, s.size()-1){
int t = 0;
for (int j = 1; i - j + 1 >= 0 && i + j<s.size(); j++){
if (s[i-j+1] == s[i+j]){
t += 2;
}
}
ans = max(ans, t);
}
cout<<ans<<endl;
return 0;
}
hirokazu1020