Блог пользователя harshit2202

Автор harshit2202, история, 7 лет назад, По-английски

Problem Statement

Unable to solve the problem Editorial is also not available . Can anybody explain? Thanks in advance:)

Теги #dp
  • Проголосовать: нравится
  • +7
  • Проголосовать: не нравится

»
7 лет назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

Store an array b where b[i] is the sum of all aj = i

So in the sample, b would be {2, 10, 6}, the problem turns into a simple DP problem, if you are at state i you have 2 options:

1) leave b[i] and move to state i + 1

2) take b[i] and move to state i + R + 1