結果
問題 | No.2386 Udon Coupon (Easy) |
ユーザー |
|
提出日時 | 2023-07-21 21:46:45 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 3 ms / 2,000 ms |
コード長 | 465 bytes |
コンパイル時間 | 1,730 ms |
コンパイル使用メモリ | 168,820 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-09-21 23:15:03 |
合計ジャッジ時間 | 2,460 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 37 |
ソースコード
#include<bits/stdc++.h>using namespace std;typedef long long ll;int main(){ios::sync_with_stdio(false);cin.tie(0);int n;cin >> n;std::vector<int> b(3);std::vector<int> f(n + 1);for(int i = 0;i < 3;i ++)cin >> b[i];std::vector<int> a = {3,5,10};for(int i = 0;i < 3;i ++){for(int j = a[i];j <= n;j ++){f[j] = max(f[j - a[i]] + b[i],f[j]);}}cout << f[n] << "\n";return 0;}