CPCRC1C - Sum of Digits
Majid is a 3rd-grade elementary student and quite well in mathematics. Once, Majid's teacher asked him to calculate the sum of numbers 1 through n.
Majid quickly answered, and his teacher made him another challenge. He asked Majid to calculate the sum of the digits of numbers 1 through n.
Majid did finally find the solution. Now it is your turn, can you find a solution?
Two space-separated integers 0 <= a <= b <= 109.
Program terminates if a and b are -1.
The sum of the digits of numbers a through b.
Standard digit DP Problem.Last edit: 2021-04-26 19:03:30
Please fill your dp with -1 two times.. I literally wasted my 4 hours because of that :(
easy peasy ...
3Dp Problem With State As: (pos,sum,tight)
AC in one go!
Basic Digit dp problem
Well got my first digit dp problem accepted, Thanks for the question. DIGIT DP works like a bliss!
it can be tagged as combinatorics
just same as this one .....here b<=1e15