UCLA ACM Quarterly Programming Contest
Fall 2009 Contest: Lucky Numbers
A professor at UCLA is famous for his theory of lucky numbers. According to his theory 4 and 7 are lucky digits, and all the other digits are not lucky. A lucky number is a number that contains only lucky digits in decimal notation. A very lucky number is a number that can be expressed as a product of several lucky numbers. A lucky number by itself is considered to be very lucky. For example, numbers 47, 49, 112 are very lucky. Your task is to calculate the number of very lucky numbers that are not less than A and not greater than B. Of course, numbers A and B are given by the professor.
Input
Input will be from standard in.
The first line of the input contains a single integer T – a number of test cases. Each of the next T lines contains two integers separated by a single space – A and B.
Output
Output should be to standard out.
Output must contain T lines – answers for the test cases.
Constraints
1 ≤ T ≤ 7777,
1 ≤ A ≤ B ≤ 1000000000000 (10^12).
Sample Input
4 12 88 99 112 112 1 100
Sample Output
0 0 1 10
Prizes
$50 Amazon Gift Certificate
Submission Deadline
December 4th, 2009 12:00 AM
Frequently Asked Questions
None yet!
Questions can be directed to the Contests Chair.
Contest Rules
The Association for Computing Machinery (ACM) at UCLA provides Computer Science students with a quarterly series of programming contests. These contests have been designed by ACM officers, Computer Science faculty or industry supporters. As incentives to participate, ACM offers prizes from HSSEAS and/or industry funding as well as published credentials and bragging rights.
Reasons to participate
1. You enjoyed tackling programming problems from CS 31/32
2. "Winner of ACM Programming Contests" is a nice resume point
3. Participation gives you a challenge to discuss during interviews
4. You could win cool prizes (gift cards, peripherals, software)
5. Recruiters have asked to see the resumes of winners
Submission Policy
Submissions must include name, year and e-mail address, either in a separate text file or at the top of the source code. ACM reserves the right to forward your code to industry sponsors. The UCLA ACM website contains updates regarding contest information: problem specifications, answers to frequently asked questions and announcements of the winner(s). After the deadline, the winners will be e-mailed to arrange prize delivery, and may also be contacted on behalf of industry sponsors.
Grading
Grading will be based first on correctness and then on performance. Submissions will be tested on the SEASnet Windows workstations in Boelter Hall with a secret test file. Languages must be in C, C++ or Java. Input comes from Standard Input (e.g. "cin" for C++) and output goes to Standard Output (e.g. "cout" for C++). Output must be interleaved with input (i.e. generate the output immediately after each corresponding input; don't wait until all inputs have been entered to generate output). Submissions cannot run longer than 10.000 seconds or allocate more than 64 MiB on the stack.
Academic Honesty
Because ACM is a nationally-recognized organization, and because UCLA ACM is funded by HSSEAS, academic honesty is essential to the fair distribution of prizes. Contest submissions will be held to the same policy of academic honesty as submissions for Computer Science courses. Plagiarism and/or cheating may be reported to the HSSEAS Office of the Dean to be investigated. Please make sure that the code you submit is entirely your own. UCLA ACM wants to ensure that its meager contest funds are well-spent.
