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.
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
can be solved without digit dpLast edit: 2018-05-18 11:48:58
A comment was left
Digit DP :)
Good one pure math!!Finally AC