Practice on Toph

Participate in exhilarating programming contests, solve unique algorithm and data structure challenges and be a part of an awesome community.

Poltu and Digit Product

By RamprosadG · Limits 1s, 512 MB

Poltu gives another interesting problem to his friend Boltu. The description is given below-

You are given two integer L and R. You have to find the summation of digit product of all number from L to R(inclusive).

Example of digit product:

The digit product of 154 = 1 × 5 × 4 = 20.
The digit product of 1214 = 1 × 2 × 1 × 4 = 8.


The first line contains an integer T(1T100), number of test cases.
Next T lines contain two integer L and R(1LR101000).


For each test case print the case number and result MOD (109 + 7).


12 14
8 10
Case 1: 9
Case 2: 17



    29% Solution Ratio

    steinumEarliest, 4w ago

    steinumFastest, 0.0s

    steinumLightest, 131 kB

    steinumShortest, 754B


    Login to submit


    This is a DP problem. You can solve this problem with Digit DP. If you don't know about Digit DP...