PR003004 - Digit Sum
For a pair of integers a and b, the digit sum of the interval [a,b] is defined as the sum of all digits occurring in all numbers between (and including) a and b. For example, the digit sum of [28, 31] can be calculated as:
2+8 + 2+9 + 3+0 + 3+1 = 28
Given the numbers a and b, calculate the digit sum of [a,b].
On the first line one positive number: the number of test cases, at most 100.
After that per test case:
- one line with two space-separated integers, a and b (0 <= a <= b <= 10^15).
Per test case:
- one line with an integer: the digit sum of [a,b];
Input: 3 0 10 28 31 1234 56789 Output: 46 28 1128600
easy peasy ...
can anyone help me iam getting tle tried code of gfg digit sum plz give any link for studying
this problem have something rare. I have the same situation as dwij28, 3 comments below
Hmm weird, I got WA for CRCRC1C, but got AC for this one with literally the same code.
LOL I forgot to change my DP memory from CPCRC1C.
Answer should technically always fit in the range of long long int. But my C++ solution gives a WA but its exact 100% translation into python gives AC. Can someone tell me what could be the reason behind it ?
just ctrl c and ctrl v !! CPRC1C
copy paste CPCRC1C and got AC in one go......:-)
CPCRC1C accepted but NZEC here :(
Same as CPCRC1C except with higher upper limit.