結果

問題 No.1158 GCD Products easy
ユーザー Mitarushi
提出日時 2020-08-11 15:27:24
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
AC  
実行時間 355 ms / 2,000 ms
コード長 323 bytes
コンパイル時間 116 ms
コンパイル使用メモリ 12,544 KB
実行使用メモリ 10,880 KB
最終ジャッジ日時 2024-10-09 11:26:00
合計ジャッジ時間 2,053 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 25
権限があれば一括ダウンロードができます

ソースコード

diff #

from math import gcd
import sys


def input():
    return sys.stdin.readline()


a, b, n = [int(i) for i in input().split()]
mod = 10**9+7
ans = 1


def c(gc, n):
    global ans
    if n == 0:
        ans *= gc
        ans %= mod
        return
    for i in range(a, b + 1):
        c(gcd(gc, i), n-1)


c(0, n)
print(ans)
0