1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#include <cstdio>

bool check(unsigned long long n) {
    int a = 1;
    int var = 9;
    int i = 1;
    int num[10] = {0};
    while(i < 10) {
        if (n % i == 0) num[i] = 1;
        i++;
    }
    while(n > 0 || var == 0) {
        if(num[n % 10] == 0) return false;
        else {
            n = n / 10;
            var--;
        }
    }
    return true;
}

int main() {
    unsigned long long l = 0;
    unsigned long long r = 0;
    unsigned long long count = 0;
    scanf("%llu", &l);
    getchar();
    scanf("%llu", &r);
    while(l <= r) {
        if(check(l)) count++;
        l++;
    }
    printf("%llu", count);
    return 0;
}