結果

問題 No.1158 GCD Products easy
ユーザー lam6er
提出日時 2025-03-20 20:28:00
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 196 ms / 2,000 ms
コード長 332 bytes
コンパイル時間 173 ms
コンパイル使用メモリ 82,740 KB
実行使用メモリ 76,780 KB
最終ジャッジ日時 2025-03-20 20:29:00
合計ジャッジ時間 2,426 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 25
権限があれば一括ダウンロードができます

ソースコード

diff #

import itertools
import math
from functools import reduce

MOD = 10**9 + 7

A, B, N = map(int, input().split())

values = list(range(A, B + 1))
product_tuples = itertools.product(values, repeat=N)

result = 1
for tup in product_tuples:
    current_gcd = reduce(math.gcd, tup)
    result = (result * current_gcd) % MOD

print(result)
0