結果
問題 | No.2386 Udon Coupon (Easy) |
ユーザー |
|
提出日時 | 2023-07-21 22:10:13 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 3 ms / 2,000 ms |
コード長 | 468 bytes |
コンパイル時間 | 515 ms |
コンパイル使用メモリ | 68,736 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-09-21 23:40:56 |
合計ジャッジ時間 | 1,579 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 37 |
ソースコード
#include <iostream>#include <vector>#define rep(i, n) for (int i = 0; i < (n); ++i)typedef long long ll;using namespace std;int main(int, char const *[]){int n, a,b,c;int ans = 0;cin >> n >> a >> b >> c;vector<int> dp(n+1,0);rep(i,n+1){if(i>=3)dp[i]=max(dp[i-3]+a,dp[i]);if(i>=5)dp[i]=max(dp[i-5]+b,dp[i]);if(i>=10)dp[i]=max(dp[i-10]+c,dp[i]);}ans = dp[n];cout << ans << endl;return 0;}// vim: set ts=2 sw=2 sts=2: