How can I memoize this digit dp problem's rec solution?

Правка en2, от dv.jakhar_, 2021-08-11 21:09:05

Hello codeforces community!

Problem:

Given a lowerlimit and upperlimit (Values on coupon).

A coupon containing the sumofdigits= S will win the lottery. Find S in such a way that max no of people win the lottery.

In short return the count of sum (S) that is repeating max no of times. And the ways to choose that count.

Ex: LL:1 UP:5

array:[1,2,3,4,5]

Sumof digits: [1,2,3,4,5]

Count:1

No of ways to choose that count :5 (max count =1 for 5 )

Ex: LL:1 UP: 10

Array [1,2,3,4,5,6,7,8,9,10]

Sumofdigits: [1,2,3,4,5,6,7,8,9,1]

Count: 2 (sum=1 is repeating 2 times)

No of ways to choose :1

Constraints: 1<=lowerlimit<upperlimit<=10^18

My solution[C++]

Now I want to memoize this rec solution but can't find a way to do it(as currently the func's return type is void). Can someone pls help :) Thanks!

Теги #help, # dp

История

 
 
 
 
Правки
 
 
  Rev. Язык Кто Когда Δ Комментарий
en2 Английский dv.jakhar_ 2021-08-11 21:09:05 23
en1 Английский dv.jakhar_ 2021-08-11 21:07:14 1620 Initial revision (published)