結果
問題 |
No.273 回文分解
|
ユーザー |
![]() |
提出日時 | 2016-01-25 23:58:39 |
言語 | Python2 (2.7.18) |
結果 |
WA
|
実行時間 | - |
コード長 | 450 bytes |
コンパイル時間 | 304 ms |
コンパイル使用メモリ | 6,912 KB |
実行使用メモリ | 6,272 KB |
最終ジャッジ日時 | 2024-12-23 13:14:40 |
合計ジャッジ時間 | 1,240 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 29 WA * 3 |
ソースコード
S = raw_input() ans = 0 for i in range(len(S) - 1): left,right = 1,1 cnt = 1 while i - left >= 0 and i + right < len(S) and S[i - left] == S[i + right]: cnt += 2 left += 1 right += 1 if cnt == len(S):cnt = 1 ans = max(ans,cnt) for i in range(len(S) - 1): left,right = i,i + 1 cnt = 0 while left >= 0 and right < len(S) and S[left] == S[right]: cnt += 2 left -= 1 right += 1 if cnt == len(S):cnt = 1 ans = max(ans,cnt) print ans