結果

問題 No.368 LCM of K-products
ユーザー nebukuro09nebukuro09
提出日時 2016-10-21 14:11:50
言語 PyPy2
(7.3.15)
結果
AC  
実行時間 599 ms / 2,000 ms
コード長 630 bytes
コンパイル時間 387 ms
コンパイル使用メモリ 77,568 KB
実行使用メモリ 79,792 KB
最終ジャッジ日時 2023-10-23 21:20:10
合計ジャッジ時間 5,532 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 132 ms
79,488 KB
testcase_01 AC 231 ms
79,416 KB
testcase_02 AC 81 ms
78,740 KB
testcase_03 AC 136 ms
79,792 KB
testcase_04 AC 106 ms
79,520 KB
testcase_05 AC 599 ms
78,668 KB
testcase_06 AC 72 ms
76,944 KB
testcase_07 AC 72 ms
76,944 KB
testcase_08 AC 71 ms
76,284 KB
testcase_09 AC 71 ms
76,284 KB
testcase_10 AC 72 ms
76,284 KB
testcase_11 AC 71 ms
76,284 KB
testcase_12 AC 73 ms
76,944 KB
testcase_13 AC 115 ms
79,248 KB
testcase_14 AC 142 ms
79,496 KB
testcase_15 AC 150 ms
79,524 KB
testcase_16 AC 139 ms
79,532 KB
testcase_17 AC 130 ms
79,560 KB
testcase_18 AC 152 ms
79,544 KB
testcase_19 AC 92 ms
78,084 KB
testcase_20 AC 130 ms
79,480 KB
testcase_21 AC 84 ms
76,944 KB
testcase_22 AC 148 ms
79,540 KB
testcase_23 AC 71 ms
76,284 KB
testcase_24 AC 71 ms
76,284 KB
testcase_25 AC 72 ms
76,284 KB
testcase_26 AC 72 ms
76,284 KB
testcase_27 AC 71 ms
76,284 KB
testcase_28 AC 70 ms
76,284 KB
testcase_29 AC 70 ms
76,284 KB
testcase_30 AC 71 ms
76,284 KB
testcase_31 AC 71 ms
76,284 KB
testcase_32 AC 71 ms
76,284 KB
testcase_33 AC 101 ms
78,504 KB
testcase_34 AC 93 ms
79,300 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

MOD = 10**9+7

def prime_decomposition(n):
    i = 2
    table = {}
    while i * i <= n:
        while n % i == 0:
            n /= i
            table[i] = table.get(i, 0) + 1
        i += 1
    if n > 1:
        table[n] = table.get(n, 0) + 1
    return table

N, K = map(int, raw_input().split())
A = map(int, raw_input().split())
d = {}
for a in A:
    for k, v in prime_decomposition(a).items():
        if k in d:
            d[k].append(v)
        else:
            d[k] = [v]

ans = 1
for k, v in d.items():
    nv = sorted(v, reverse=True)
    for i in xrange(min(K, len(v))):
        ans = ans*k**nv[i] % MOD
print ans
0