結果

問題 No.2138 Add Bacon
ユーザー ころまるぼーい
提出日時 2023-04-14 15:09:03
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
AC  
実行時間 32 ms / 2,000 ms
コード長 356 bytes
コンパイル時間 124 ms
コンパイル使用メモリ 12,416 KB
実行使用メモリ 10,624 KB
最終ジャッジ日時 2024-10-10 06:47:12
合計ジャッジ時間 1,905 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 25
権限があれば一括ダウンロードができます

ソースコード

diff #

A, B, C, D, E = map(int, input().split())

ans = -float("inf")  # 幸福度の最大値を負の無限大で初期化

for i in range(C+1):
    satis = A + i*D  # 現在の美味しさ
    cal = B + i*E  # 現在のカロリー数
    happiness = satis - cal  # 現在の幸福度
    ans = max(ans, happiness)  # 幸福度の最大値を更新

print(ans)
0