結果

問題 No.1158 GCD Products easy
ユーザー Akijin_007
提出日時 2022-11-04 13:47:57
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 156 ms / 2,000 ms
コード長 360 bytes
コンパイル時間 145 ms
コンパイル使用メモリ 82,432 KB
実行使用メモリ 76,116 KB
最終ジャッジ日時 2024-07-18 13:24:06
合計ジャッジ時間 1,955 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 25
権限があれば一括ダウンロードができます

ソースコード

diff #

#int(input())
#map(int, input().split())
#list(map(int, input().split()))

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

mod = 10 ** 9 + 7

from itertools import product
from math import gcd

ans = 1

l = list(range(A, B+1))
# print(l)

for x in product(l, repeat=N):
    g = x[0]
    for i in range(N):
        g = gcd(g, x[i])
    ans = (ans * g) % mod

print(ans)


0