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
39
40
41
42
43
44
45
46
47
48
#include <iostream>

using namespace std;

unsigned long long Number;
bool k = true;
void IsPotyczkowa(unsigned long long x)
{
	if (x > 9)
	{
		IsPotyczkowa(x / 10);
	}
	if (!k)
	{
		return;
	}
	int digit = x % 10;

	if (digit == 0)
	{
		k = false;
		return;
	}

	if (Number % digit != 0)
	{
		k = false;
		return;
	}
}

int main()
{
	unsigned long long min, max;
	cin >> min >> max;
	unsigned long long n = 0;
	for (Number = min; Number <= max; Number++)
	{
		k = true;
		IsPotyczkowa(Number);

		if (k)
		{
			n++;
		}
	}
	cout << n << endl;
}