結果

問題 No.1973 Divisor Sequence
ユーザー titiatitia
提出日時 2022-06-11 01:07:14
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 420 ms / 2,000 ms
コード長 665 bytes
コンパイル時間 1,122 ms
コンパイル使用メモリ 81,776 KB
実行使用メモリ 76,020 KB
最終ジャッジ日時 2023-10-21 07:12:44
合計ジャッジ時間 4,697 ms
ジャッジサーバーID
(参考情報)
judge9 / judge10
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 40 ms
53,696 KB
testcase_01 AC 40 ms
53,696 KB
testcase_02 AC 191 ms
75,744 KB
testcase_03 AC 70 ms
75,732 KB
testcase_04 AC 141 ms
75,744 KB
testcase_05 AC 78 ms
75,684 KB
testcase_06 AC 141 ms
75,744 KB
testcase_07 AC 80 ms
75,744 KB
testcase_08 AC 111 ms
75,744 KB
testcase_09 AC 130 ms
75,744 KB
testcase_10 AC 153 ms
75,900 KB
testcase_11 AC 75 ms
75,748 KB
testcase_12 AC 132 ms
75,744 KB
testcase_13 AC 82 ms
75,892 KB
testcase_14 AC 133 ms
76,020 KB
testcase_15 AC 175 ms
75,744 KB
testcase_16 AC 174 ms
75,744 KB
testcase_17 AC 142 ms
75,900 KB
testcase_18 AC 82 ms
75,876 KB
testcase_19 AC 180 ms
75,956 KB
testcase_20 AC 86 ms
75,740 KB
testcase_21 AC 168 ms
75,744 KB
testcase_22 AC 154 ms
75,744 KB
testcase_23 AC 368 ms
75,796 KB
testcase_24 AC 420 ms
75,892 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input = sys.stdin.readline

N,M=map(int,input().split())

mod=10**9+7

x=M

# 素因数分解
import math 
L=int(math.sqrt(x))

FACT=dict()

for i in range(2,L+2):
    while x%i==0:
        FACT[i]=FACT.get(i,0)+1
        x=x//i

if x!=1:
    FACT[x]=FACT.get(x,0)+1

def calc(LEN,N):
    DP=[1]*LEN
    
    for tests in range(N-1):
        NDP=[0]*LEN

        for j in range(LEN):
            NDP[LEN-1-j]+=DP[j]

        DP=[0]*LEN

        DP[-1]=NDP[-1]

        for j in range(LEN-2,-1,-1):
            DP[j]=DP[j+1]+NDP[j]
            DP[j]%=mod

    return sum(DP)%mod

ANS=1
for f in FACT.values():
    ANS*=calc(f+1,N)
    ANS%=mod

print(ANS)
0