Dynamic Programming21 sections · 916 units
Open in Course

Codeforces 455A Boredom - Base Cases

Starting conditions

3.3. Set the base cases

You need to define dp[0]dp[0] and dp[1]dp[1]. There are no positive numbers when you only consider values up to 00, so dp[0]=0.dp[0] = 0. When you consider values up to 11, the only possible value is 11. **

You can either take it or not take it. The best is to take all ones, so dp[1]=1cnt[1].dp[1] = 1 \cdot \text{cnt}[1]. Now, think about the final answer! Take time to work through examples.