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
#include <iostream>
int isPotyczkow(int initNumber){
    int answer = 1;
    int curNumber = initNumber;
    while(curNumber > 0){
        int mod10 = curNumber % 10;
        curNumber /= 10;
        if (mod10 == 0){
            answer = 0;
            break;
        }
        int remainder = initNumber % mod10;
        if (remainder != 0){
            answer = 0;
            break;
        } 
    }
    return answer;
}
int main() {
    long long left, right;
    long sum = 0;
    std::cin >> left >> right;
    for(int i = left; i <= right; i++){
        sum += isPotyczkow(i);
    }
    std::cout << sum << std::endl;
    return 0;
}