結果
| 問題 | No.599 回文かい |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2025-08-09 14:14:09 |
| 言語 | PyPy3 (7.3.17) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 491 bytes |
| 記録 | |
| コンパイル時間 | 233 ms |
| コンパイル使用メモリ | 96,104 KB |
| 実行使用メモリ | 83,712 KB |
| 最終ジャッジ日時 | 2026-07-13 22:22:55 |
| 合計ジャッジ時間 | 3,672 ms |
|
ジャッジサーバーID (参考情報) |
judge3_0 / judge2_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| 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)