TheLuckyNumbers
SRM 403 · 2008-05-29 · by Vasyl[alphacom]
SRM 403 · 2008-05-29 · by Vasyl[alphacom] · Brute Force
Problem Statement
Problem Statement
John thinks 4 and 7 are lucky digits, and all other digits are not lucky. A lucky number is a number that contains only lucky digits in decimal notation.
You are given
Constraints
- a will be between 1 and 1,000,000,000, inclusive.
- b will be between a and 1,000,000,000, inclusive.
Examples
0)
1 10 Returns: 2
There are only two lucky numbers among the first ten positive integers.
1)
11 20 Returns: 0
But there are none among the next ten.
2)
74 77 Returns: 2
These two numbers are lucky. There are no additional lucky numbers between them.
3)
1000000 5000000 Returns: 64
4)
1 1000000000 Returns: 1022
Submissions are judged against all 67 archived test cases, of which 5 are shown here. Case numbers match the judge’s.
Coding Area
Language: C++17 · define a public class TheLuckyNumbers with a public method int count(int a, int b) · 67 test cases · 2 s / 256 MB per case