結果
問題 | No.1973 Divisor Sequence |
ユーザー |
![]() |
提出日時 | 2022-06-10 22:08:45 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 484 ms / 2,000 ms |
コード長 | 757 bytes |
コンパイル時間 | 174 ms |
コンパイル使用メモリ | 81,980 KB |
実行使用メモリ | 76,900 KB |
最終ジャッジ日時 | 2024-09-21 07:30:05 |
合計ジャッジ時間 | 4,543 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 22 |
ソースコード
def factorization(n): arr = [] temp = n for i in range(2, int(-(-n**0.5//1))+1): if temp%i==0: cnt=0 while temp%i==0: cnt+=1 temp //= i arr.append([i, cnt]) if temp!=1: arr.append([temp, 1]) if arr==[]: arr.append([n, 1]) return arr N,M=map(int,input().split()) mod=10**9+7 ans=1 if M==1: print(1) exit() from collections import Counter C=Counter([a[1] for a in factorization(M)]) def score(x): dp=[0]*(x+1) dp[0]=1 for _ in range(N): dp2=[0]*(x+1) a=sum(dp)%mod for j in range(x+1): dp2[j]=a a-=dp[x-j] a%=mod dp=dp2.copy() return sum(dp)%mod for c in C: ans*=pow(score(c),C[c],mod) ans%=mod print(ans)