結果

問題 No.1781 LCM
ユーザー ikdikd
提出日時 2021-12-10 19:03:02
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
RE  
実行時間 -
コード長 592 bytes
コンパイル時間 297 ms
コンパイル使用メモリ 10,948 KB
実行使用メモリ 20,696 KB
最終ジャッジ日時 2023-09-25 16:04:57
合計ジャッジ時間 7,688 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 16 ms
7,908 KB
testcase_01 RE -
testcase_02 RE -
testcase_03 RE -
testcase_04 RE -
testcase_05 RE -
testcase_06 RE -
testcase_07 AC 16 ms
7,824 KB
testcase_08 AC 15 ms
7,824 KB
testcase_09 AC 634 ms
17,132 KB
testcase_10 AC 1,045 ms
19,088 KB
testcase_11 AC 16 ms
7,776 KB
testcase_12 AC 16 ms
7,776 KB
testcase_13 AC 434 ms
11,100 KB
testcase_14 AC 1,056 ms
20,696 KB
testcase_15 AC 371 ms
12,408 KB
testcase_16 AC 240 ms
10,936 KB
testcase_17 AC 548 ms
13,824 KB
testcase_18 AC 459 ms
13,832 KB
testcase_19 AC 16 ms
7,848 KB
testcase_20 RE -
testcase_21 RE -
testcase_22 RE -
testcase_23 AC 16 ms
7,752 KB
testcase_24 RE -
testcase_25 RE -
testcase_26 RE -
testcase_27 RE -
testcase_28 RE -
testcase_29 RE -
testcase_30 RE -
testcase_31 AC 16 ms
7,780 KB
testcase_32 AC 16 ms
7,772 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

def main():
    n, m = map(int, input().split())
    assert n <= 200000 and m <= 200000

    count_divisors = [0] * (m + 1)
    for i in range(1, m + 1):
        for j in range(i, m + 1, i):
            count_divisors[j] += 1

    mod = 998244353
    count_lcm = [pow(count_divisors[l], n, mod) for l in range(m + 1)]
    for i in range(1, m + 1):
        for j in range(i + i, m + 1, i):
            count_lcm[j] -= count_lcm[i]

    ans = 0
    for l in range(1, m + 1):
        ans += (m // l) * count_lcm[l] % mod
        ans %= mod
    print(ans)


if __name__ == "__main__":
    main()
0