結果
問題 |
No.273 回文分解
|
ユーザー |
![]() |
提出日時 | 2016-01-04 08:57:18 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 706 bytes |
コンパイル時間 | 1,241 ms |
コンパイル使用メモリ | 158,428 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-12-23 13:14:11 |
合計ジャッジ時間 | 2,292 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 17 WA * 15 |
ソースコード
#include <bits/stdc++.h> using namespace std; int main(){ string s; cin >> s; int ans = 0,check = 0; if(s.size() == 2) ans = 1; else{ for(int i = 0; i < s.size()-ans; i++){ for(int j = i + 1; j < s.size(); j++){ if(s[i] == s[j]){ // cout << s[i] << " " << s[j] << endl; int x = j; for(int k = i+1; k <= (i+j)/2; k++){ x--; // cout << x << endl; // cout << k << " " << x << endl; // cout << s[k] << " " << s[x] << endl; if(s[k] == s[x]) check = 1; else{ check = 0; break; } } if(check){ ans = max(ans,j-i+1); check = 0; } } } } } cout << ans << endl; return 0; }