Probably a Digit DP problem. Haven’t tried but probably is something on the lines of finding F(x) which denotes the number of numbers smaller than or equal to x satisfying the condition specified in the question. The answer can then be calculated by F(r) - F(l -1) and assuming F(0) = 0.
There is one question which comes in NCR hackerearth contest
problem statement - An array of n element and we have to choose the A[i] and after that the value of whole array becomes 50% of its current value we have to choose elment such that sum >=x( where x is given in each query) we have to tell how may combination will satisfy this eqaution
anyone who had solved this question can share their approach.
It is same as reading accepted solution to the question mentioned by the OP, just code and no explanation at all. @ssjgz time to call you for help . Can you have a look at the question or use the Editorial/Accepted Solution and explain how it works?