結果

問題 No.1158 GCD Products easy
ユーザー brthyyjpbrthyyjp
提出日時 2021-07-04 18:13:05
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 313 ms / 2,000 ms
コード長 390 bytes
コンパイル時間 977 ms
コンパイル使用メモリ 86,864 KB
実行使用メモリ 77,928 KB
最終ジャッジ日時 2023-09-14 00:00:49
合計ジャッジ時間 6,538 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 113 ms
72,556 KB
testcase_01 AC 117 ms
72,296 KB
testcase_02 AC 120 ms
72,496 KB
testcase_03 AC 113 ms
72,492 KB
testcase_04 AC 110 ms
72,620 KB
testcase_05 AC 113 ms
76,644 KB
testcase_06 AC 113 ms
72,648 KB
testcase_07 AC 129 ms
77,656 KB
testcase_08 AC 110 ms
72,504 KB
testcase_09 AC 112 ms
72,516 KB
testcase_10 AC 109 ms
72,588 KB
testcase_11 AC 109 ms
72,692 KB
testcase_12 AC 117 ms
77,564 KB
testcase_13 AC 108 ms
72,364 KB
testcase_14 AC 110 ms
72,448 KB
testcase_15 AC 111 ms
72,736 KB
testcase_16 AC 113 ms
72,648 KB
testcase_17 AC 118 ms
72,540 KB
testcase_18 AC 119 ms
72,524 KB
testcase_19 AC 118 ms
72,516 KB
testcase_20 AC 111 ms
72,812 KB
testcase_21 AC 110 ms
72,724 KB
testcase_22 AC 109 ms
72,624 KB
testcase_23 AC 112 ms
72,488 KB
testcase_24 AC 123 ms
77,820 KB
testcase_25 AC 109 ms
72,792 KB
testcase_26 AC 313 ms
77,928 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import math
from functools import reduce

def gcd(*numbers):
    return reduce(fractions.gcd, numbers)
    #return reduce(math.gcd, numbers)

def gcd_list(numbers):
    return reduce(math.gcd, numbers)

a, b, n = map(int, input().split())
import itertools
mod = 10**9+7
ans = 1
for p in itertools.product(range(a, b+1), repeat=n):
    g = gcd_list(p)
    ans *= g
    ans %= mod
print(ans)
0