Блог пользователя Mr.Awesome

Автор Mr.Awesome, история, 8 лет назад, По-английски

I was checking some solution of this problem, and I didn't understand 2 things, let's look at this solution , first why we loop over k j(0..k), and second why k replaced by j and k-j in each call?

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

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

when you're trying to cut the bar of chocolate in every horizental and vertical way, you also need to try to take every possible number of chocolate squares from the new chocolate bar.so you're looping over k and trying to take every possible number of chocolate squares every time you cut the chocolate bar