Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- for (int i = 1; i <= n; i++)
- dp[i] = -inf;
- dp[0] = 0;
- for (int i = min(a, b, c); i <= n; i++)
- {
- if (i >= a) dp[i] = max( dp[i], dp[i - a] + 1 );
- if (i >= b) dp[i] = max( dp[i], dp[i - b] + 1 );
- if (i >= c) dp[i] = max( dp[i], dp[i - c] + 1 );
- }
- ответ -> dp[n];
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement