結果

問題 No.599 回文かい
ユーザー shotoyooshotoyoo
提出日時 2021-09-26 10:17:20
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 574 bytes
コンパイル時間 369 ms
コンパイル使用メモリ 86,880 KB
実行使用メモリ 86,304 KB
最終ジャッジ日時 2023-09-19 02:49:58
合計ジャッジ時間 6,950 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 71 ms
71,052 KB
testcase_01 AC 70 ms
71,108 KB
testcase_02 AC 71 ms
71,036 KB
testcase_03 AC 72 ms
71,040 KB
testcase_04 AC 84 ms
75,852 KB
testcase_05 AC 82 ms
75,560 KB
testcase_06 AC 90 ms
75,992 KB
testcase_07 AC 87 ms
76,004 KB
testcase_08 AC 84 ms
76,000 KB
testcase_09 AC 81 ms
75,456 KB
testcase_10 TLE -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
evil_0.txt -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input = lambda : sys.stdin.readline().rstrip()

write = lambda x: sys.stdout.write(x+"\n")
debug = lambda x: sys.stderr.write(x+"\n")
writef = lambda x: print("{:.12f}".format(x))

def sub(s):
    s = [ord(c) for c in s]
    n = len(s)
    m = (n)//2 + 1
    dp = [0]*(m)
    dp[0] = 1
    for i in range(1,m):
        val = 0
        for j in range(i):
            if s[j:i]==s[n-i:n-j]:
                val += dp[j]
                if val>M:
                    val -= M
        dp[i] = val%M
    return sum(dp)
M = 10**9+7
s = input()
ans = sub(s)
print(ans%M)
0