結果

問題 No.176 2種類の切手
ユーザー 👑 rin204rin204
提出日時 2022-07-06 07:05:34
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 77 ms / 1,000 ms
コード長 310 bytes
コンパイル時間 482 ms
コンパイル使用メモリ 87,268 KB
実行使用メモリ 75,696 KB
最終ジャッジ日時 2023-08-22 22:26:06
合計ジャッジ時間 4,741 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 74 ms
70,992 KB
testcase_01 AC 75 ms
71,448 KB
testcase_02 AC 72 ms
71,136 KB
testcase_03 AC 73 ms
71,124 KB
testcase_04 AC 74 ms
71,264 KB
testcase_05 AC 73 ms
71,284 KB
testcase_06 AC 73 ms
71,228 KB
testcase_07 AC 72 ms
71,256 KB
testcase_08 AC 73 ms
71,408 KB
testcase_09 AC 74 ms
71,292 KB
testcase_10 AC 72 ms
71,024 KB
testcase_11 AC 73 ms
71,000 KB
testcase_12 AC 74 ms
71,132 KB
testcase_13 AC 74 ms
71,096 KB
testcase_14 AC 74 ms
71,388 KB
testcase_15 AC 74 ms
71,368 KB
testcase_16 AC 74 ms
71,228 KB
testcase_17 AC 72 ms
71,264 KB
testcase_18 AC 73 ms
71,304 KB
testcase_19 AC 72 ms
71,232 KB
testcase_20 AC 73 ms
71,264 KB
testcase_21 AC 73 ms
71,476 KB
testcase_22 AC 74 ms
71,112 KB
testcase_23 AC 73 ms
71,288 KB
testcase_24 AC 74 ms
71,240 KB
testcase_25 AC 74 ms
71,312 KB
testcase_26 AC 71 ms
71,040 KB
testcase_27 AC 73 ms
71,020 KB
testcase_28 AC 72 ms
71,368 KB
testcase_29 AC 77 ms
75,696 KB
testcase_30 AC 77 ms
75,644 KB
testcase_31 AC 72 ms
71,104 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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