結果

問題 No.2576 LCM Pattern
ユーザー 👑 H20H20
提出日時 2023-11-22 22:55:18
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 42 ms / 2,000 ms
コード長 533 bytes
コンパイル時間 172 ms
コンパイル使用メモリ 81,700 KB
実行使用メモリ 59,332 KB
最終ジャッジ日時 2023-12-03 23:30:05
合計ジャッジ時間 2,069 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 39 ms
53,460 KB
testcase_01 AC 39 ms
53,460 KB
testcase_02 AC 39 ms
53,460 KB
testcase_03 AC 39 ms
53,460 KB
testcase_04 AC 42 ms
53,460 KB
testcase_05 AC 39 ms
53,460 KB
testcase_06 AC 39 ms
53,460 KB
testcase_07 AC 41 ms
59,328 KB
testcase_08 AC 39 ms
53,460 KB
testcase_09 AC 39 ms
53,460 KB
testcase_10 AC 39 ms
53,460 KB
testcase_11 AC 38 ms
53,460 KB
testcase_12 AC 39 ms
53,460 KB
testcase_13 AC 38 ms
53,460 KB
testcase_14 AC 40 ms
53,460 KB
testcase_15 AC 42 ms
59,332 KB
testcase_16 AC 39 ms
53,460 KB
testcase_17 AC 38 ms
53,460 KB
testcase_18 AC 42 ms
53,460 KB
testcase_19 AC 39 ms
53,460 KB
testcase_20 AC 39 ms
55,612 KB
testcase_21 AC 38 ms
53,460 KB
testcase_22 AC 38 ms
53,460 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import collections
#素因数分解
def prime_factorize(n):
    a = []
    while n % 2 == 0:
        a.append(2)
        n //= 2
    f = 3
    while f * f <= n:
        if n % f == 0:
            a.append(f)
            n //= f
        else:
            f += 2
    if n != 1:
        a.append(n)
    return a

N,M = map(int, input().split())
CP = collections.Counter(prime_factorize(M))
mod = 998244353
ans = 1
V = list(CP.values())#各素因数の指数を算出
for v in V:
    ans=ans*(pow(v+1,N,mod)-pow(v,N,mod))%mod
print(ans)
0