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.
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
wooooo !!!!! learned a new thing "DIGIT DP" :-)
Do with digit DP
I don't know why I'm getting WA though my code passes every test case....those present on spojtoolkit as well...
Very Nice Problem!!
Digit Dp :)