Submission #3262647


Source Code Expand

Copy
mod = 1000000007

# nの素因数分解


def prime(n):
    d = []
    i = 2
    while n != 1:
        s = 0
        while n % i == 0:
            n /= i
            s += 1
        d.append(s)
        i += 1
    return d


# xのn乗を計算する
def mod_pow(x, n):
    if n == 0:
        return 1
    elif n % 2 == 0:
        half = int(n / 2)
        half_x = mod_pow(x, half)
        return half_x * half_x % mod
    else:
        return x * mod_pow(x, n - 1) % mod


def nCr(n, r):
    x = 1
    r = min(r, n - r)
    for i in range(r):
        x *= n - i
        x %= mod
        x *= mod_pow(i + 1, mod - 2)
        x %= mod
    return x


def solve():
    N, M = map(int, input().split())
    p = prime(M)
    s = 1
    for i in p:
        s *= nCr(i + N - 1, N - 1)
        s %= mod
    print(s)


solve()

Submission Info

Submission Time
Task D - Factorization
User taku0728
Language PyPy3 (2.4.0)
Score 0
Code Size 868 Byte
Status

Test Cases

Set Name Score / Max Score Test Cases
All 0 / 400 0_small_1, 0_small_2, 0_small_3, 1_large_1, 1_large_2, 1_large_3, 2_large_1, 2_large_2, 3_prime_1, 3_prime_10, 3_prime_11, 3_prime_12, 3_prime_13, 3_prime_14, 3_prime_15, 3_prime_16, 3_prime_17, 3_prime_18, 3_prime_19, 3_prime_2, 3_prime_20, 3_prime_21, 3_prime_22, 3_prime_3, 3_prime_4, 3_prime_5, 3_prime_6, 3_prime_7, 3_prime_8, 3_prime_9, 4_hand_1, 4_hand_2, 4_hand_3, sample_01, sample_02, sample_03
Sample 0 / 0 sample_01, sample_02, sample_03
Case Name Status Exec Time Memory
0_small_1 162 ms 38256 KB
0_small_2 161 ms 38256 KB
0_small_3 163 ms 38256 KB
1_large_1 182 ms 46448 KB
1_large_2
1_large_3 171 ms 39152 KB
2_large_1 195 ms 64368 KB
2_large_2 169 ms 39024 KB
3_prime_1 164 ms 38384 KB
3_prime_10 162 ms 38256 KB
3_prime_11 162 ms 38256 KB
3_prime_12 161 ms 38256 KB
3_prime_13 162 ms 38256 KB
3_prime_14 161 ms 38256 KB
3_prime_15 161 ms 38256 KB
3_prime_16 161 ms 38256 KB
3_prime_17 161 ms 38256 KB
3_prime_18 161 ms 38256 KB
3_prime_19 162 ms 38256 KB
3_prime_2 163 ms 38256 KB
3_prime_20 161 ms 38256 KB
3_prime_21 162 ms 38256 KB
3_prime_22 166 ms 38256 KB
3_prime_3 162 ms 38256 KB
3_prime_4 163 ms 38256 KB
3_prime_5 162 ms 38256 KB
3_prime_6 161 ms 38256 KB
3_prime_7 163 ms 38256 KB
3_prime_8 162 ms 38256 KB
3_prime_9 162 ms 38256 KB
4_hand_1 168 ms 38256 KB
4_hand_2 162 ms 38256 KB
4_hand_3 161 ms 38256 KB
sample_01 162 ms 38256 KB
sample_02 162 ms 38256 KB
sample_03 161 ms 38256 KB