結果
問題 |
No.273 回文分解
|
ユーザー |
![]() |
提出日時 | 2016-02-18 21:32:07 |
言語 | Python2 (2.7.18) |
結果 |
AC
|
実行時間 | 12 ms / 2,000 ms |
コード長 | 418 bytes |
コンパイル時間 | 84 ms |
コンパイル使用メモリ | 7,040 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-06-25 13:35:08 |
合計ジャッジ時間 | 1,460 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 32 |
ソースコード
# -*- coding: utf-8 -*- def ch(S): N = len(S) SR = S[:] SR.reverse() if S == SR: return N else: return 0 S = list(raw_input()) N = len(S) cntmax = 0 if len(S) == 2: print 1 exit() for i in range(0, N-1): for j in range(i+1, N+1): tmp = ch(S[i:j]) if cntmax < tmp: cntmax = tmp if cntmax ==len(S): print cntmax - 2 else: print cntmax