結果

問題 No.1164 GCD Products hard
ユーザー H3PO4H3PO4
提出日時 2022-08-24 15:44:05
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
TLE  
実行時間 -
コード長 550 bytes
コンパイル時間 175 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 90,976 KB
最終ジャッジ日時 2024-04-20 05:21:52
合計ジャッジ時間 59,190 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 TLE -
testcase_01 TLE -
testcase_02 AC 2,300 ms
66,504 KB
testcase_03 AC 1,132 ms
50,236 KB
testcase_04 AC 998 ms
50,480 KB
testcase_05 TLE -
testcase_06 TLE -
testcase_07 TLE -
testcase_08 TLE -
testcase_09 AC 2,230 ms
67,784 KB
testcase_10 AC 1,130 ms
49,204 KB
testcase_11 AC 2,348 ms
69,284 KB
testcase_12 TLE -
testcase_13 AC 2,021 ms
63,192 KB
testcase_14 AC 1,397 ms
67,596 KB
testcase_15 TLE -
testcase_16 AC 1,741 ms
69,564 KB
testcase_17 TLE -
testcase_18 AC 2,348 ms
67,684 KB
testcase_19 AC 966 ms
50,992 KB
testcase_20 AC 1,546 ms
56,624 KB
testcase_21 TLE -
testcase_22 AC 487 ms
44,216 KB
testcase_23 AC 1,671 ms
83,456 KB
testcase_24 TLE -
testcase_25 -- -
testcase_26 -- -
testcase_27 -- -
testcase_28 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

import numpy as np


def primes_np(n):
    is_prime = np.ones(n + 1, dtype=bool)
    is_prime[0] = False
    is_prime[1] = False
    for i in range(2, int(n ** 0.5) + 1):
        if not is_prime[i]:
            continue
        is_prime[i * 2:n + 1:i] = False
    return np.where(is_prime)[0].tolist()


A, B, N = map(int, input().split())
MOD = 10 ** 9 + 7

ans = 1
for pr in primes_np(B):
    x = pr
    while x <= B:
        ct = B // x - (A - 1) // x
        ans *= pow(pr, pow(ct, N, MOD - 1), MOD)
        ans %= MOD
        x *= pr
print(ans)
0