結果

問題 No.2386 Udon Coupon (Easy)
ユーザー yuusaan
提出日時 2024-10-07 11:41:06
言語 C++23
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 941 ms / 2,000 ms
コード長 335 bytes
コンパイル時間 3,015 ms
コンパイル使用メモリ 244,252 KB
実行使用メモリ 6,820 KB
最終ジャッジ日時 2024-10-07 11:41:23
合計ジャッジ時間 16,843 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 37
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>

using namespace std;

int main(){
    int n,a,b,c;
    cin >> n >> a >> b >> c;
    int ans = 0;
    for(int j = 0;j * 10 <= n;j++){
        for(int i = 0;j * 10 + i * 5 <= n;i++){
            ans = max(ans,j * c + i * b + (n - j * 10 - i * 5) / 3 * a);
        }
    }
    cout << ans << endl;
    return 0;
}
0