結果

問題 No.2425 Power Range GCD
ユーザー mattu34mattu34
提出日時 2023-08-18 22:02:59
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 508 ms / 2,000 ms
コード長 598 bytes
コンパイル時間 164 ms
コンパイル使用メモリ 82,304 KB
実行使用メモリ 76,928 KB
最終ジャッジ日時 2024-05-06 04:05:21
合計ジャッジ時間 4,878 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 38 ms
53,248 KB
testcase_01 AC 400 ms
76,928 KB
testcase_02 AC 508 ms
76,800 KB
testcase_03 AC 408 ms
76,400 KB
testcase_04 AC 417 ms
76,780 KB
testcase_05 AC 411 ms
76,556 KB
testcase_06 AC 39 ms
53,632 KB
testcase_07 AC 39 ms
53,888 KB
testcase_08 AC 38 ms
53,888 KB
testcase_09 AC 39 ms
53,632 KB
testcase_10 AC 39 ms
53,376 KB
testcase_11 AC 40 ms
53,248 KB
testcase_12 AC 38 ms
53,632 KB
testcase_13 AC 39 ms
53,888 KB
testcase_14 AC 39 ms
53,632 KB
testcase_15 AC 38 ms
53,632 KB
testcase_16 AC 38 ms
54,016 KB
testcase_17 AC 38 ms
53,632 KB
testcase_18 AC 39 ms
53,632 KB
testcase_19 AC 39 ms
53,504 KB
testcase_20 AC 38 ms
53,632 KB
testcase_21 AC 38 ms
53,376 KB
testcase_22 AC 39 ms
53,632 KB
testcase_23 AC 38 ms
54,144 KB
testcase_24 AC 162 ms
76,928 KB
testcase_25 AC 104 ms
76,384 KB
testcase_26 AC 45 ms
59,776 KB
testcase_27 AC 117 ms
76,672 KB
testcase_28 AC 154 ms
76,672 KB
testcase_29 AC 149 ms
76,680 KB
testcase_30 AC 160 ms
76,748 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from collections import defaultdict


def prime_factorize(n):
    V = defaultdict(int)
    i = 2
    while i**2 <= n:
        while n % i == 0:
            V[i] += 1
            n //= i
        i += 1
    if n != 1:
        V[n] += 1
    return V


L, R = map(int, input().split())
base = prime_factorize(L)
base[1] = 1
for key, val in base.items():
    base[key] *= L

for num in range(L + 1, R + 1):
    b = prime_factorize(num)
    for key, val in base.items():
        b[key] *= num
        base[key] = min(base[key], b[key])
ans = 1
for key, val in base.items():
    ans *= key**val
print(ans)
0