結果

問題 No.368 LCM of K-products
ユーザー 🍡yurahuna🍡yurahuna
提出日時 2016-04-05 20:28:15
言語 Python2
(2.7.18)
結果
TLE  
実行時間 -
コード長 657 bytes
コンパイル時間 592 ms
コンパイル使用メモリ 6,912 KB
実行使用メモリ 13,880 KB
最終ジャッジ日時 2024-04-14 22:10:22
合計ジャッジ時間 8,356 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 531 ms
13,568 KB
testcase_01 AC 1,838 ms
7,424 KB
testcase_02 AC 23 ms
6,940 KB
testcase_03 AC 567 ms
6,944 KB
testcase_04 AC 147 ms
6,940 KB
testcase_05 TLE -
testcase_06 -- -
testcase_07 -- -
testcase_08 -- -
testcase_09 -- -
testcase_10 -- -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
testcase_25 -- -
testcase_26 -- -
testcase_27 -- -
testcase_28 -- -
testcase_29 -- -
testcase_30 -- -
testcase_31 -- -
testcase_32 -- -
testcase_33 -- -
testcase_34 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

from collections import defaultdict as ddict

N, K = map(int, raw_input().split())
a = list(map(int, raw_input().split()))

exponents = ddict(list)
for ax in a:
    # primeFactrization
    cnt = ddict(int)
    i = 2
    while i * i <= ax:
        while ax % i == 0:
            cnt[i] +=  1
            ax /= i
        i += 1
    if ax != 1:
        cnt[ax] += 1

    for key, value in cnt.items():
        exponents[key].append(value)



mod = 10**9 + 7

ans = 1
for prime, li in exponents.items():
    li.sort(reverse = True)
    num = 0
    for i in range(min(K, len(li))):
        num += li[i]

    ans *= pow(prime, num, mod)
    ans %= mod

print ans
0