Playing with digits
Practice
4.1 (36 votes)
Digit dp
Dynamic programming
Algorithms
Advanced
Math
Problem
90% Success 9039 Attempts 30 Points 1s Time Limit 256MB Memory 1024 KB Max Code
Determine the number of integers that are available from \(A\) to \(B\) (inclusive) and satisfy the following conditions:
- Sum of its digits is equal to a prime number
- Divisible by \(k\)
Input format
The first and only line contains three space-separated positive integers \(A\), \(B\), and \(K\).
Output format
Print a single integer that denotes the answer to this question.
Constraints
\(0 < A,\ B,\ K ≤ 2*(10^{10})\\ A ≤ B\)
Submissions
Please login to view your submissions
Similar Problems
Points:20
290 votes
Tags:
MathematicsOpenApprovedEasyProbability and Statistics
Points:30
2 votes
Tags:
OpenDynamic ProgrammingAlgorithmsExpectationApprovedMedium
Points:30
3 votes
Tags:
MediumAlgorithmsStringDP
Editorial