結果

問題 No.1164 GCD Products hard
ユーザー MitarushiMitarushi
提出日時 2020-08-11 15:37:43
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 1,115 ms / 2,500 ms
コード長 570 bytes
コンパイル時間 203 ms
コンパイル使用メモリ 82,276 KB
実行使用メモリ 154,276 KB
最終ジャッジ日時 2024-04-17 17:19:28
合計ジャッジ時間 18,381 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 738 ms
129,512 KB
testcase_01 AC 913 ms
135,708 KB
testcase_02 AC 663 ms
120,076 KB
testcase_03 AC 207 ms
84,348 KB
testcase_04 AC 211 ms
85,920 KB
testcase_05 AC 750 ms
129,028 KB
testcase_06 AC 935 ms
139,760 KB
testcase_07 AC 939 ms
143,836 KB
testcase_08 AC 909 ms
143,176 KB
testcase_09 AC 650 ms
122,512 KB
testcase_10 AC 208 ms
83,216 KB
testcase_11 AC 713 ms
125,340 KB
testcase_12 AC 921 ms
139,432 KB
testcase_13 AC 545 ms
113,884 KB
testcase_14 AC 541 ms
121,696 KB
testcase_15 AC 952 ms
144,592 KB
testcase_16 AC 655 ms
126,384 KB
testcase_17 AC 741 ms
127,280 KB
testcase_18 AC 664 ms
122,680 KB
testcase_19 AC 232 ms
86,916 KB
testcase_20 AC 340 ms
98,948 KB
testcase_21 AC 1,031 ms
144,552 KB
testcase_22 AC 34 ms
53,088 KB
testcase_23 AC 938 ms
154,012 KB
testcase_24 AC 1,115 ms
154,276 KB
testcase_25 AC 33 ms
52,344 KB
testcase_26 AC 32 ms
53,360 KB
testcase_27 AC 34 ms
52,936 KB
testcase_28 AC 33 ms
53,132 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

a, b, n = [int(i) for i in input().split()]

ans = 1
mod = 10**9+7

table = [True] * (b + 1)
table[0] = False
table[1] = False
for i in range(b + 1):
    if table[i]:
        for j in range(i * i, b + 1, i):
            table[j] = False

        lower = (a-1)//i
        upper = b // i
        power = 0
        while True:
            power += pow(upper - lower, n, mod - 1)
            power%=mod-1
            lower //= i
            upper //= i
            if upper - lower == 0:
                break
        ans *= pow(i, power, mod)
        ans %= mod
print(ans)
0