結果

問題 No.588 空白と回文
ユーザー lloyzlloyz
提出日時 2022-08-28 09:43:54
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 395 bytes
コンパイル時間 332 ms
コンパイル使用メモリ 82,536 KB
実行使用メモリ 75,692 KB
最終ジャッジ日時 2024-04-23 08:47:34
合計ジャッジ時間 2,158 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 33 ms
52,920 KB
testcase_01 AC 36 ms
52,552 KB
testcase_02 AC 36 ms
52,968 KB
testcase_03 WA -
testcase_04 AC 37 ms
53,072 KB
testcase_05 AC 38 ms
52,268 KB
testcase_06 AC 42 ms
59,628 KB
testcase_07 AC 37 ms
52,612 KB
testcase_08 AC 34 ms
52,940 KB
testcase_09 AC 35 ms
52,380 KB
testcase_10 AC 36 ms
52,752 KB
testcase_11 WA -
testcase_12 AC 55 ms
75,204 KB
testcase_13 WA -
testcase_14 AC 36 ms
52,284 KB
testcase_15 WA -
testcase_16 AC 36 ms
51,952 KB
testcase_17 AC 55 ms
73,580 KB
testcase_18 AC 37 ms
53,852 KB
testcase_19 AC 38 ms
52,552 KB
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

S = input()

n = len(S)
ans = 1
for i in range(n):
    j = 1
    res = 1
    while i - j >= 0 and i + j < n:
        if S[i - j] == S[i + j]:
            res += 2
        j += 1
    ans = max(ans, res)
for i in range(n - 1):
    j = 0
    res = 0
    while i - j >= 0 and i + j + 1 < n:
        if S[i - j] == S[i + j + 1]:
            res += 1
        j += 1
    ans = max(ans, res)
print(ans)
0