結果

問題 No.2386 Udon Coupon (Easy)
ユーザー tabrtabr
提出日時 2023-07-21 22:06:55
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 46 ms / 2,000 ms
コード長 955 bytes
コンパイル時間 1,935 ms
コンパイル使用メモリ 209,136 KB
実行使用メモリ 4,348 KB
最終ジャッジ日時 2023-10-21 22:07:43
合計ジャッジ時間 4,222 ms
ジャッジサーバーID
(参考情報)
judge12 / judge9
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,348 KB
testcase_01 AC 2 ms
4,348 KB
testcase_02 AC 2 ms
4,348 KB
testcase_03 AC 2 ms
4,348 KB
testcase_04 AC 1 ms
4,348 KB
testcase_05 AC 2 ms
4,348 KB
testcase_06 AC 1 ms
4,348 KB
testcase_07 AC 43 ms
4,348 KB
testcase_08 AC 2 ms
4,348 KB
testcase_09 AC 2 ms
4,348 KB
testcase_10 AC 43 ms
4,348 KB
testcase_11 AC 38 ms
4,348 KB
testcase_12 AC 43 ms
4,348 KB
testcase_13 AC 44 ms
4,348 KB
testcase_14 AC 44 ms
4,348 KB
testcase_15 AC 42 ms
4,348 KB
testcase_16 AC 44 ms
4,348 KB
testcase_17 AC 43 ms
4,348 KB
testcase_18 AC 43 ms
4,348 KB
testcase_19 AC 24 ms
4,348 KB
testcase_20 AC 44 ms
4,348 KB
testcase_21 AC 44 ms
4,348 KB
testcase_22 AC 44 ms
4,348 KB
testcase_23 AC 42 ms
4,348 KB
testcase_24 AC 45 ms
4,348 KB
testcase_25 AC 45 ms
4,348 KB
testcase_26 AC 45 ms
4,348 KB
testcase_27 AC 45 ms
4,348 KB
testcase_28 AC 43 ms
4,348 KB
testcase_29 AC 45 ms
4,348 KB
testcase_30 AC 36 ms
4,348 KB
testcase_31 AC 44 ms
4,348 KB
testcase_32 AC 26 ms
4,348 KB
testcase_33 AC 45 ms
4,348 KB
testcase_34 AC 43 ms
4,348 KB
testcase_35 AC 46 ms
4,348 KB
testcase_36 AC 45 ms
4,348 KB
testcase_37 AC 42 ms
4,348 KB
testcase_38 AC 44 ms
4,348 KB
testcase_39 AC 44 ms
4,348 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
#ifdef tabr
#include "library/debug.cpp"
#else
#define debug(...)
#endif

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    long long n;
    cin >> n;
    vector<pair<int, int>> c(3);
    c[0].first = 3;
    c[1].first = 5;
    c[2].first = 10;
    for (int i = 0; i < 3; i++) {
        cin >> c[i].second;
    }
    sort(c.begin(), c.end(), [&](auto x, auto y) {
        return x.second * y.first < y.second * x.first;
    });
    vector<long long> a(3), b(3);
    for (int i = 0; i < 3; i++) {
        a[i] = c[i].first;
        b[i] = c[i].second;
    }
    long long ans = 0;
    for (int i = 0; i < 2023; i++) {
        for (int j = 0; j < 2023; j++) {
            if (a[0] * i + a[1] * j > n) {
                break;
            }
            ans = max(ans, b[0] * i + b[1] * j + b[2] * ((n - a[0] * i - a[1] * j) / a[2]));
        }
    }
    cout << ans << '\n';
    return 0;
}
0