結果
問題 | No.2386 Udon Coupon (Easy) |
ユーザー |
![]() |
提出日時 | 2023-07-22 01:28:55 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 22 ms / 2,000 ms |
コード長 | 510 bytes |
コンパイル時間 | 2,261 ms |
コンパイル使用メモリ | 192,652 KB |
最終ジャッジ日時 | 2025-02-15 17:54:16 |
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 37 |
ソースコード
#define rep(i,n) for(int i=0;i<(int)(n);i++)#define ALL(v) v.begin(),v.end()typedef long long ll;#include <bits/stdc++.h>using namespace std;ll dp[200200];int main(){ios::sync_with_stdio(false);std::cin.tie(nullptr);int n,a,b,c;cin>>n>>a>>b>>c;dp[n]=0;ll ans=0;for(int i=n;i>=0;i--){if(i>=3) dp[i-3]=max(dp[i-3],dp[i]+a);if(i>=5) dp[i-5]=max(dp[i-5],dp[i]+b);if(i>=10) dp[i-10]=max(dp[i-10],dp[i]+c);ans=max(ans,dp[i]);}cout<<ans<<endl;return 0;}