CodeForces 247 div2C

Revision en3, by tirupati, 2015-07-03 11:21:04

This is my first blog post here and also this is the first dp problem I was able to solve by myself. So, I thought I should celebrate it by publishing a blog entry. Here it goes..., We have to find the sum of the numbers(range[1...k]) such that their sum forms n. Also it's given that there must be at least one entry with value >=d. So this is equivalent to...

Required Number of Paths = (total number of paths which sum to n using range[1...k]) - (total number of paths which sum to n using range[1...d-1])

Each of the two subproblems on the R.H.S can be individually solved using dp. You can see the solution here

PS: Feel free to suggest improvements or show up bugs :D Thank You..,

Tags dp

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en4 English tirupati 2015-07-03 13:06:24 183
en3 English tirupati 2015-07-03 11:21:04 60
en2 English tirupati 2015-07-03 11:19:38 434 (published)
en1 English tirupati 2015-07-03 11:13:33 296 Initial revision (saved to drafts)