結果

問題 No.588 空白と回文
ユーザー toyuzukotoyuzuko
提出日時 2020-08-24 23:01:43
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 399 bytes
コンパイル時間 176 ms
コンパイル使用メモリ 82,688 KB
実行使用メモリ 76,032 KB
最終ジャッジ日時 2024-04-24 03:59:42
合計ジャッジ時間 2,108 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 35 ms
52,096 KB
testcase_01 AC 34 ms
51,968 KB
testcase_02 AC 37 ms
52,096 KB
testcase_03 AC 68 ms
76,032 KB
testcase_04 AC 34 ms
51,840 KB
testcase_05 AC 35 ms
51,968 KB
testcase_06 AC 43 ms
57,856 KB
testcase_07 AC 38 ms
51,584 KB
testcase_08 AC 35 ms
51,840 KB
testcase_09 AC 39 ms
51,840 KB
testcase_10 AC 35 ms
51,840 KB
testcase_11 AC 72 ms
76,032 KB
testcase_12 AC 53 ms
68,736 KB
testcase_13 WA -
testcase_14 AC 36 ms
51,840 KB
testcase_15 WA -
testcase_16 AC 35 ms
51,584 KB
testcase_17 AC 57 ms
70,400 KB
testcase_18 AC 35 ms
51,712 KB
testcase_19 AC 36 ms
51,712 KB
testcase_20 WA -
testcase_21 AC 60 ms
72,064 KB
testcase_22 WA -
testcase_23 AC 60 ms
69,504 KB
testcase_24 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

S = input()
L = len(S)
res = 0
for i in range(L):
    tmp = 1
    for j in range(min(i, L - 1 - i)):
        if S[i - j - 1] == S[i + j + 1]:
            tmp += 2
    res = max(res, tmp)
for i in range(L - 1):
    if S[i] != S[i + 1]:
        continue
    tmp = 2
    for j in range(min(i, L - 2 - i)):
        if S[i - j - 1] == S[i + j + 2]:
            tmp += 2
    res = max(res, tmp)
print(res)
0