Can somebody explain the dynamic programming approach in CIELRCPT?

Hi here’s the link could somebody please explain the dynamic programming approach for this question given in the editorial…here’s the link…

how to get eqn (2)…what does Ai actually represent,if L=F§,what does it signify…i didnt anything much in the whole thing…
could somebody please help…thanks

it has another easier way of solution. just check here:

note on my code: initialize the array of power 2, starting from 0 goes to 11. after getting p, starting from the maximum value of array(here 2048, index is arr[11]=2048) and check if p is equal to or greater than that value. if so, p=p-arr[i], count++. i also increased i++ so that continues from the index last visited. thnx

also, if you have difficulty in understanding DP, check these:

actually, mit dp is 3 section so here is query:

there is no need of dp here its a simple cakewalk approach