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

using namespace std;

int main()
{
    unsigned long long l, r, result = 0;
    bool success;
    cin >> l >> r;
    for (unsigned long long i = l; i<r; i++) {
        unsigned long long temp = i;
        success = true;
        while (temp != 0) {
            if (temp % 10 == 0) {
                success = false;
                break;
            }
            else if (i % (temp % 10)) {
                success = false;
                break;
            }
            temp /= 10;
        }
        if(success) {
            result++;
            //cout<<i<<endl;
        }
            
    }
    cout << result;
}