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
#include <cstdio>

bool is_Potyczkow_number(unsigned long long x)
{
    const unsigned long long num = x;
    int digit;
    while (x > 0) {
        digit = x % 10;
        x /= 10;
        if(digit == 0 || num % digit)
            return false;
    }
    return true;
}

int main()
{
    unsigned long long l, r, count = 0;
    scanf("%llu %llu", &l, &r);
    for(unsigned long long i = l; i <= r; i++)  {
        if(is_Potyczkow_number(i))
            count++;
    }
    printf("%llu\n", count);
    return 0;
}