Cut Ribbon
MediumRating 1300Codeforces1-D Dynamic Programming
Approach hintTry it first, then revealHide
Let dp[i] be the most pieces that exactly form length i, marking unreachable lengths. Each length extends dp[i - a], dp[i - b] or dp[i - c] by one piece.