結果

問題 No.2576 LCM Pattern
ユーザー titiatitia
提出日時 2023-12-04 02:03:33
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 83 ms / 2,000 ms
コード長 414 bytes
コンパイル時間 296 ms
コンパイル使用メモリ 81,700 KB
実行使用メモリ 76,004 KB
最終ジャッジ日時 2023-12-04 02:03:36
合計ジャッジ時間 2,401 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 38 ms
53,588 KB
testcase_01 AC 37 ms
53,588 KB
testcase_02 AC 42 ms
59,768 KB
testcase_03 AC 38 ms
53,460 KB
testcase_04 AC 38 ms
53,460 KB
testcase_05 AC 44 ms
60,024 KB
testcase_06 AC 47 ms
60,024 KB
testcase_07 AC 40 ms
57,428 KB
testcase_08 AC 47 ms
60,024 KB
testcase_09 AC 42 ms
59,512 KB
testcase_10 AC 64 ms
68,964 KB
testcase_11 AC 49 ms
62,116 KB
testcase_12 AC 83 ms
76,004 KB
testcase_13 AC 57 ms
66,904 KB
testcase_14 AC 64 ms
68,964 KB
testcase_15 AC 39 ms
57,428 KB
testcase_16 AC 37 ms
53,584 KB
testcase_17 AC 40 ms
57,428 KB
testcase_18 AC 41 ms
57,428 KB
testcase_19 AC 41 ms
57,428 KB
testcase_20 AC 42 ms
57,428 KB
testcase_21 AC 41 ms
57,428 KB
testcase_22 AC 37 ms
53,588 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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

mod=998244353

def fact(x):
    LIST=[]

    for i in range(1,round(x**(1/2))+2):
        if x%i==0:
            LIST.append(i)
            LIST.append(x//i)

    return set(LIST)

ANS=dict()

SA=sorted(fact(M))

for a in SA:
    L=fact(a)

    score=pow(len(L),N,mod)

    for k in L:
        if k==a:
            continue
        score-=ANS[k]

    ANS[a]=score

print(ANS[M]%mod)

0