結果
| 問題 |
No.273 回文分解
|
| コンテスト | |
| ユーザー |
newlife171128
|
| 提出日時 | 2018-01-28 20:09:46 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 832 bytes |
| コンパイル時間 | 1,525 ms |
| コンパイル使用メモリ | 161,060 KB |
| 実行使用メモリ | 6,824 KB |
| 最終ジャッジ日時 | 2024-12-29 14:55:10 |
| 合計ジャッジ時間 | 2,726 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 WA * 2 |
| other | AC * 13 WA * 19 |
ソースコード
#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 ==0){
cout<<1<<endl;
}else if(ans ==2 && s.length() ==2){
cout<<1<<endl;
}else if(ans =s.length()){
cout<<ans-2<<endl;
}
return 0;
}
newlife171128