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

using namespace std;

bool potyczkow(int num) {

	if (num % 10 == 0) {
		return false;
	}

	int tmp = num;
	while (tmp > 0) {
		if (num % (tmp % 10) != 0) {
			return false;
		}
		tmp /= 10;
	}
	return true;
}

int main()
{
	int l, r, ile = 0;
	cin >> l >> r;

	for (int i = l; i < r; i++) {
		if (potyczkow(i)) {
			ile++;
		}
	}
	cout << ile;
	return 0;
}