結果

問題 No.176 2種類の切手
ユーザー yn
提出日時 2015-09-01 13:40:40
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
AC  
実行時間 50 ms / 1,000 ms
コード長 294 bytes
コンパイル時間 368 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 11,264 KB
最終ジャッジ日時 2024-10-08 03:32:42
合計ジャッジ時間 2,331 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 29
権限があれば一括ダウンロードができます

ソースコード

diff #

a, b, t = map(int,input().split())
# a円の切手x枚, b円の切手y枚

ans = []

for y in range(a):
    x = (t - b * y) // a
    if (t - b * y) % a != 0:
        x += 1

    if x < 0 :
        break
    ans.append(a * x + b * y)

    if  b * y > t :
        break

ans.sort()

print(ans[0])
0