結果

問題 No.588 空白と回文
ユーザー wajima_wataruwajima_wataru
提出日時 2018-01-03 18:50:28
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 284 ms / 2,000 ms
コード長 485 bytes
コンパイル時間 150 ms
コンパイル使用メモリ 10,736 KB
実行使用メモリ 7,952 KB
最終ジャッジ日時 2023-08-24 17:57:13
合計ジャッジ時間 3,283 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 15 ms
7,796 KB
testcase_01 AC 15 ms
7,816 KB
testcase_02 AC 16 ms
7,840 KB
testcase_03 AC 284 ms
7,880 KB
testcase_04 AC 15 ms
7,796 KB
testcase_05 AC 14 ms
7,880 KB
testcase_06 AC 16 ms
7,788 KB
testcase_07 AC 15 ms
7,828 KB
testcase_08 AC 15 ms
7,796 KB
testcase_09 AC 15 ms
7,952 KB
testcase_10 AC 15 ms
7,832 KB
testcase_11 AC 284 ms
7,784 KB
testcase_12 AC 246 ms
7,840 KB
testcase_13 AC 16 ms
7,880 KB
testcase_14 AC 16 ms
7,836 KB
testcase_15 AC 15 ms
7,832 KB
testcase_16 AC 15 ms
7,876 KB
testcase_17 AC 169 ms
7,812 KB
testcase_18 AC 16 ms
7,800 KB
testcase_19 AC 16 ms
7,816 KB
testcase_20 AC 257 ms
7,876 KB
testcase_21 AC 210 ms
7,732 KB
testcase_22 AC 250 ms
7,952 KB
testcase_23 AC 156 ms
7,804 KB
testcase_24 AC 15 ms
7,800 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

S = input()
N = len(S)
ans = 1
for center in range(N):
    tmp = 1
    for idx in range(1, N):
        if not (0 <= center - idx and center + idx < N):
            break
        if S[center - idx] == S[center + idx]:
            tmp += 2
    ans = max(ans, tmp)
    tmp = 0
    for idx in range(N):
        if not (0 <= center - 1 - idx and center + idx < N):
            break
        if S[center - 1 - idx] == S[center + idx]:
            tmp += 2
    ans = max(ans, tmp)
print(ans)
0