結果
問題 |
No.273 回文分解
|
ユーザー |
![]() |
提出日時 | 2016-01-25 23:56:21 |
言語 | Python2 (2.7.18) |
結果 |
WA
|
実行時間 | - |
コード長 | 398 bytes |
コンパイル時間 | 196 ms |
コンパイル使用メモリ | 6,912 KB |
実行使用メモリ | 6,400 KB |
最終ジャッジ日時 | 2024-12-23 13:14:39 |
合計ジャッジ時間 | 1,708 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 WA * 1 |
other | AC * 28 WA * 4 |
ソースコード
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 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 ans = max(ans,cnt) print ans