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
36
37
38
#include <iostream>
using namespace std;
int main()
{
    unsigned long long l,r;
    cin>>l>>r;
    unsigned long long a=0;
    unsigned long long b=0;
    unsigned long long w=0;

    for(int i=l; i<r; i++)
    {
        if(i%10 != 0)
        {
            a=i;//12
            while(a!=0)
            {
                b=a%10;//2
                if(i%b==0)
                {
                    a=a/10;
                }
                else
                {
                    break;
                }
            }
            if(a==0)
            {
                w++;
            }
        }

    }

    cout<<w;
    return 0;
}