DigIT
Practice
3.8 (60 votes)
Dynamic programming
Combinatorics
Hard
Number theory
Brute Force search
Open
Approved
Problem
86% Success 4874 Attempts 50 Points 5s Time Limit 512MB Memory 1024 KB Max Code
This problem is as simple as short. Just find how many numbers from A to B with sum of digits from X to Y are divisible by K.
Input
The first line contains 5 space-separated positive integers: A, B, X, Y, K
Output
Output one number - answer for the question.
Constraints
- 0 < A, B, K ≤ 1013
- 0 < X, Y ≤ 1000
- A ≤ B
- 0 < A, B, ≤ 107 in 32 % of the test data
Submissions
Please login to view your submissions
Similar Problems
Points:50
4 votes
Tags:
String3D dynamic programmingDynamic ProgrammingAlgorithms
Points:50
22 votes
Tags:
ReadyBasic ProgrammingHard
Points:50
4 votes
Tags:
Dynamic ProgrammingAlgorithms3 DimensionalHard
Editorial