結果
問題 |
No.273 回文分解
|
ユーザー |
![]() |
提出日時 | 2018-01-28 19:59:07 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 755 bytes |
コンパイル時間 | 1,382 ms |
コンパイル使用メモリ | 160,388 KB |
実行使用メモリ | 6,824 KB |
最終ジャッジ日時 | 2024-12-29 14:49:11 |
合計ジャッジ時間 | 2,599 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 16 WA * 16 |
ソースコード
#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){ cout<<1<<endl; }else { cout<<ans<<endl; } return 0; }