JZPEXT  Beautiful numbers EXTREME
We call one integer beautiful, if and only if it is divisible by each of its nonzero digits. Given an interval [l, r], calculate how many beautiful numbers n satisfy l<=n<=r.
Input
First line, the number of test cases, t.
Then t lines follow, each line two numbers l, r, representing the query interval [l, r].
1<=t<=2.5*10^4
1<=l<=r<=10^18
Output
t lines. The tth line is the answer to the tth query.
Example
Input: 1 1 100
Output:
33
hide comments
deva_raut:
20170909 12:36:06
can someone give me an optimized code my code is running but the time complexity for large input is very high 

Scape:
20150721 17:42:58
What is the damn purpose of this problem? And why the hell source limit? I wasted 2 hours optimizing my solution only to find out it's too long. Got AC afterwards but this problem sucks hard. 

Sourangsu :
20131212 11:05:36
Not much fun in solving this... Last edit: 20131212 11:06:35 

South_stream:
20130901 14:04:16
who can tell me the real answer....I can't do it .. TLE always.. 

[Rampage] Blue.Mary:
20120130 15:44:50
Resource: Codeforces Beta Round #55.

Added by:  sevenkplus 
Date:  20110117 
Time limit:  0.114s 
Source limit:  1024B 
Memory limit:  1536MB 
Cluster:  Cube (Intel G860) 
Languages:  All 