結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 72 ms
75,880 KB
testcase_01 AC 74 ms
71,064 KB
testcase_02 AC 74 ms
71,352 KB
testcase_03 AC 73 ms
71,280 KB
testcase_04 AC 86 ms
75,980 KB
testcase_05 WA -
testcase_06 AC 89 ms
76,024 KB
testcase_07 AC 88 ms
75,980 KB
testcase_08 AC 87 ms
76,076 KB
testcase_09 WA -
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)
0