結果
| 問題 | 
                            No.599 回文かい
                             | 
                    
| コンテスト | |
| ユーザー | 
                             Bioinfo_K
                         | 
                    
| 提出日時 | 2017-11-25 10:30:46 | 
| 言語 | Python3  (3.13.1 + numpy 2.2.1 + scipy 1.14.1)  | 
                    
| 結果 | 
                             
                                WA
                                 
                             
                            
                         | 
                    
| 実行時間 | - | 
| コード長 | 400 bytes | 
| コンパイル時間 | 268 ms | 
| コンパイル使用メモリ | 12,544 KB | 
| 実行使用メモリ | 43,776 KB | 
| 最終ジャッジ日時 | 2024-11-27 09:52:47 | 
| 合計ジャッジ時間 | 16,961 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge1 / judge3 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| other | AC * 6 WA * 13 TLE * 3 | 
ソースコード
import sys,collections
mod = 10**9+7
sys.setrecursionlimit(mod)
s= input()
d = collections.defaultdict(lambda: 1)
def DFS(s):
    if s in d:
        return d[s]
    rh1,rh2 = 0,0
    for i in range(1,len(s)//2+1):
        rh1 = rh1 + ord(s[i-1])*(2**i)
        rh2 = rh2 + ord(s[-i])*(2**i)
        if rh1 == rh2 and s[:i] == s[-i:]:
            d[s] += DFS(s[i:-i])
    return d[s]
print(DFS(s)%mod)
            
            
            
        
            
Bioinfo_K