結果
| 問題 |
No.273 回文分解
|
| コンテスト | |
| ユーザー |
newlife171128
|
| 提出日時 | 2018-01-28 20:01:41 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 764 bytes |
| コンパイル時間 | 1,662 ms |
| コンパイル使用メモリ | 162,264 KB |
| 実行使用メモリ | 6,824 KB |
| 最終ジャッジ日時 | 2024-12-29 14:49:20 |
| 合計ジャッジ時間 | 2,650 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 24 WA * 8 |
ソースコード
#include <bits/stdc++.h>
#include <iostream>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <string>
#include <sstream>
#include <cmath>
#include <stack>
#include <queue>
#include <cctype>
#include <stdio.h>
#include <map>
#include <string.h>
#include <utility>
typedef long long ll;
using namespace std;
typedef pair<int, int> P;
int main() {
string s;
cin>>s;
int ans =0;
for(int i=0; i<s.length()-1; i++){
for(int j=i+1; j<s.length(); j++){
string tmp = s.substr(i,j-i+1);
string reve =tmp;
reverse(reve.begin(),reve.end());
if(tmp == reve){
int a = tmp.length();
ans = max(ans,a);
}
/* cout<<tmp<<endl;*/
}
}
if(ans ==2 || ans ==0){
cout<<1<<endl;
}else {
cout<<ans<<endl;
}
return 0;
}
newlife171128