結果

問題 No.1973 Divisor Sequence
ユーザー 👑 KazunKazun
提出日時 2022-06-10 21:45:20
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 207 ms / 2,000 ms
コード長 1,029 bytes
コンパイル時間 183 ms
コンパイル使用メモリ 81,652 KB
実行使用メモリ 75,328 KB
最終ジャッジ日時 2023-10-21 06:18:40
合計ジャッジ時間 2,823 ms
ジャッジサーバーID
(参考情報)
judge12 / judge9
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 38 ms
53,376 KB
testcase_01 AC 38 ms
53,376 KB
testcase_02 AC 62 ms
60,048 KB
testcase_03 AC 48 ms
60,048 KB
testcase_04 AC 57 ms
60,048 KB
testcase_05 AC 52 ms
59,896 KB
testcase_06 AC 58 ms
60,036 KB
testcase_07 AC 52 ms
60,048 KB
testcase_08 AC 53 ms
60,048 KB
testcase_09 AC 56 ms
60,048 KB
testcase_10 AC 71 ms
75,156 KB
testcase_11 AC 48 ms
60,036 KB
testcase_12 AC 56 ms
60,048 KB
testcase_13 AC 55 ms
66,224 KB
testcase_14 AC 73 ms
73,876 KB
testcase_15 AC 60 ms
60,036 KB
testcase_16 AC 60 ms
60,048 KB
testcase_17 AC 65 ms
72,356 KB
testcase_18 AC 54 ms
64,200 KB
testcase_19 AC 87 ms
75,328 KB
testcase_20 AC 50 ms
60,048 KB
testcase_21 AC 59 ms
60,048 KB
testcase_22 AC 58 ms
60,036 KB
testcase_23 AC 207 ms
75,188 KB
testcase_24 AC 150 ms
75,240 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#素因数分解
def Prime_Factorization(N):
    if N==0:
        return [[0,1]]

    if N<0:
        R=[[-1,1]]
    else:
        R=[]

    N=abs(N)

    if N&1==0:
        C=0
        while N&1==0:
            N>>=1
            C+=1
        R.append([2,C])

    if N%3==0:
        C=0
        while N%3==0:
            N//=3
            C+=1
        R.append([3,C])

    k=5
    Flag=0
    while k*k<=N:
        if N%k==0:
            C=0
            while N%k==0:
                C+=1
                N//=k
            R.append([k,C])
        k+=2+2*Flag
        Flag^=1

    if N!=1:
        R.append([N,1])

    return R
#==================================================
N,M=map(int,input().split())

F=Prime_Factorization(M)

X=1
Mod=10**9+7
D={}
for p,e in F:
    if e not in D:
        DP=[0]*(e+1); DP[0]=1

        for n in range(1,N+1):
            for i in range(1,e+1):
                DP[i]+=DP[i-1]
                DP[i]%=Mod
            DP.reverse()
        DP[e]=sum(DP)%Mod

    X*=DP[e]
    X%=Mod

print(X)
0