結果

問題 No.176 2種類の切手
コンテスト
ユーザー rin204
提出日時 2022-07-06 07:05:34
言語 PyPy3
(7.3.17)
コンパイル:
pypy3 -mpy_compile _filename_
実行:
pypy3 _filename_
結果
AC  
実行時間 38 ms / 1,000 ms
コード長 310 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 458 ms
コンパイル使用メモリ 85,076 KB
実行使用メモリ 58,240 KB
最終ジャッジ日時 2026-05-27 02:41:22
合計ジャッジ時間 2,811 ms
ジャッジサーバーID
(参考情報)
judge1_0 / judge3_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 29
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

from math import gcd

a, b, t = map(int, input().split())
if b ** 3 <= t:
    g = gcd(a, b)
    ans = (t + g - 1) // g * g
else:
    ans = 1 << 40
    i = 0
    while b * i <= t:
        j = (t - b * i + a - 1) // a
        ans = min(ans, b * i + a * j)
        i += 1
    ans = min(ans, b * i)
    
print(ans)
0