Submit | All submissions | Best solutions | Back to list |
HS11DIVS - Count the numbers! |
For given integers a and b your task is to find how many integers in the range [a,b] are divisible by a number x, and have the additional property that the sum of their digits lies in the range [l,r] for given l,r.
Input
In the first line you're given a and b ( 1 <= a <= b < 10^100 ).
In the second line you're given three positive integers x ( 1 <= x <= 10 ), l, r ( 1 <= l <= r <= 1,000 ).
Output
In the first and only line output the result modulo 1,000,000,007.
Example
Input:
1 100
5 10 50
Output:
5
Scoring
By solving this problem you score 10 points.
Added by: | Damir Ferizovic |
Date: | 2011-08-31 |
Time limit: | 0.400s |
Source limit: | 50000B |
Memory limit: | 1536MB |
Cluster: | Cube (Intel G860) |
Languages: | ADA95 ASM32 BASH BF C CSHARP C++ 4.3.2 CPP C99 CLPS CLOJURE LISP sbcl LISP clisp D ERL FSHARP FORTRAN GO HASK ICON ICK JAVA JS-RHINO LUA NEM NICE OCAML PAS-GPC PAS-FPC PERL PERL6 PHP PIKE PRLG-swi PYTHON PYTHON3 RUBY SCALA SCM guile SCM qobi ST TCL WHITESPACE |
Resource: | High School Programming League 2011/12 |