結果

問題 No.368 LCM of K-products
ユーザー 🍡yurahuna🍡yurahuna
提出日時 2016-04-05 20:29:54
言語 PyPy2
(7.3.15)
結果
AC  
実行時間 628 ms / 2,000 ms
コード長 657 bytes
コンパイル時間 1,414 ms
コンパイル使用メモリ 77,272 KB
実行使用メモリ 81,468 KB
最終ジャッジ日時 2023-10-23 21:07:55
合計ジャッジ時間 6,966 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 147 ms
80,888 KB
testcase_01 AC 246 ms
80,760 KB
testcase_02 AC 88 ms
80,564 KB
testcase_03 AC 151 ms
80,900 KB
testcase_04 AC 117 ms
80,880 KB
testcase_05 AC 628 ms
80,512 KB
testcase_06 AC 79 ms
79,172 KB
testcase_07 AC 78 ms
79,172 KB
testcase_08 AC 76 ms
78,320 KB
testcase_09 AC 76 ms
78,320 KB
testcase_10 AC 78 ms
78,320 KB
testcase_11 AC 79 ms
78,320 KB
testcase_12 AC 80 ms
79,172 KB
testcase_13 AC 129 ms
80,672 KB
testcase_14 AC 158 ms
80,908 KB
testcase_15 AC 168 ms
81,468 KB
testcase_16 AC 152 ms
80,892 KB
testcase_17 AC 144 ms
80,760 KB
testcase_18 AC 166 ms
80,904 KB
testcase_19 AC 98 ms
79,740 KB
testcase_20 AC 141 ms
80,740 KB
testcase_21 AC 94 ms
79,204 KB
testcase_22 AC 164 ms
80,920 KB
testcase_23 AC 77 ms
78,320 KB
testcase_24 AC 77 ms
78,320 KB
testcase_25 AC 77 ms
78,320 KB
testcase_26 AC 77 ms
78,320 KB
testcase_27 AC 76 ms
78,320 KB
testcase_28 AC 76 ms
78,320 KB
testcase_29 AC 77 ms
78,320 KB
testcase_30 AC 77 ms
78,320 KB
testcase_31 AC 77 ms
78,320 KB
testcase_32 AC 77 ms
78,320 KB
testcase_33 AC 111 ms
80,088 KB
testcase_34 AC 103 ms
80,700 KB
権限があれば一括ダウンロードができます

ソースコード

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