結果

問題 No.1158 GCD Products easy
ユーザー brthyyjpbrthyyjp
提出日時 2021-07-04 18:13:05
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 248 ms / 2,000 ms
コード長 390 bytes
コンパイル時間 500 ms
コンパイル使用メモリ 81,792 KB
実行使用メモリ 76,416 KB
最終ジャッジ日時 2024-07-01 07:59:00
合計ジャッジ時間 2,764 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 25
権限があれば一括ダウンロードができます

ソースコード

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