結果
| 問題 |
No.599 回文かい
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2025-08-09 14:14:09 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 491 bytes |
| コンパイル時間 | 357 ms |
| コンパイル使用メモリ | 82,656 KB |
| 実行使用メモリ | 67,032 KB |
| 最終ジャッジ日時 | 2025-08-09 14:14:12 |
| 合計ジャッジ時間 | 3,039 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 12 WA * 10 |
ソースコード
S = list(map(lambda x:ord(x), input()))
n = len(S)
if n==1:
print(1)
exit()
mod = 10**9+7
p = 1007
mod2 = mod
dp = [0]*(n//2+1)
dp[0] = 1
ans = 0
# print(SR)
pp = pow(p, mod2-2, mod2)
for i in range(n//2):
left = 0
right = 0
p_ = 1
t = dp[i]
ans += t
for j in range(i, n//2):
left += p_*S[j]
left %= mod
right = right*p+S[~j]
right %= mod
p_ *= p
p_ %= mod
if left==right:
dp[j+1] += t
dp[j+1] %= mod
ans += dp[-1]
print(ans)