結果
問題 | No.2386 Udon Coupon (Easy) |
ユーザー |
![]() |
提出日時 | 2023-07-23 21:22:01 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 48 ms / 2,000 ms |
コード長 | 701 bytes |
コンパイル時間 | 4,226 ms |
コンパイル使用メモリ | 250,108 KB |
最終ジャッジ日時 | 2025-02-15 18:38:09 |
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 37 |
ソースコード
#include <bits/stdc++.h>#include <atcoder/all>using namespace atcoder;using namespace std;using ll=long long;using ld=long double;ld pie=3.141592653589793;ll mod=998244353 ;ld inf=10000999999999900;int main(){ll n;ll a,b,c;cin >> n >> a >> b >> c;vector<ll>dp(n+1,-1);dp[0]=0;ll ans=0;for (ll i = 3; i <=n; i++){if (i-3>=0&&dp[i-3]>=0){dp[i]=max(dp[i],dp[i-3]+a);}if (i-5>=0&&dp[i-5]>=0){dp[i]=max(dp[i],dp[i-5]+b);}if (i-10>=0&&dp[i-10]>=0){dp[i]=max(dp[i],dp[i-10]+c);}ans=max(ans,dp[i]);}cout << ans << endl;}