結果

問題 No.588 空白と回文
ユーザー kohei2019kohei2019
提出日時 2022-02-13 13:45:31
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 101 ms / 2,000 ms
コード長 442 bytes
コンパイル時間 398 ms
コンパイル使用メモリ 86,792 KB
実行使用メモリ 77,088 KB
最終ジャッジ日時 2023-09-11 15:28:12
合計ジャッジ時間 4,002 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 74 ms
71,196 KB
testcase_01 AC 75 ms
71,112 KB
testcase_02 AC 73 ms
71,184 KB
testcase_03 AC 101 ms
76,880 KB
testcase_04 AC 74 ms
71,208 KB
testcase_05 AC 73 ms
71,096 KB
testcase_06 AC 80 ms
76,068 KB
testcase_07 AC 71 ms
71,256 KB
testcase_08 AC 73 ms
71,204 KB
testcase_09 AC 72 ms
71,172 KB
testcase_10 AC 73 ms
71,144 KB
testcase_11 AC 99 ms
76,908 KB
testcase_12 AC 95 ms
76,860 KB
testcase_13 AC 71 ms
71,064 KB
testcase_14 AC 74 ms
71,112 KB
testcase_15 AC 71 ms
71,112 KB
testcase_16 AC 71 ms
70,976 KB
testcase_17 AC 97 ms
77,084 KB
testcase_18 AC 72 ms
71,136 KB
testcase_19 AC 74 ms
71,208 KB
testcase_20 AC 96 ms
77,088 KB
testcase_21 AC 99 ms
76,600 KB
testcase_22 AC 101 ms
76,776 KB
testcase_23 AC 97 ms
76,908 KB
testcase_24 AC 71 ms
71,160 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

S = input()
N = len(S)
ans = 0
for i in range(N):
    center1 = i
    cnt = -1
    for j in range(center1+1):
        if 2*center1-j >= N:
            continue
        if S[j] == S[2*center1-j]:
            cnt += 2
    ans = max(ans,cnt)
    center2 = i
    cnt = 0
    for j in range(center1+1):
        if 2*center1-j+1 >= N:
            continue
        if S[j] == S[2*center1-j+1]:
            cnt += 2
    ans = max(ans,cnt)
print(ans)
0