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
#include <string>
#include <iostream>
using namespace std;

bool isPotyczkow(int number) {
	string numberString = to_string(number);

	for (int dn = 0; dn < numberString.size(); dn++) {
		if (numberString[dn] == '0')
			return false;

		if (number % (numberString[dn] - 48) != 0)
			return false;
	}
	return true;
}

int numberOfPotyczkow(int from, int to) {
	int result = 0;
	for (int n = from; n <= to; n++)
		result += isPotyczkow(n);

	return result;
}

int main() {
	int from;
	int to;
	cin >> from >> to;

	cout << numberOfPotyczkow(from, to);
}