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
#include <iostream>
#include <string>
#include <fstream>

int main()
{
    long long l, r;
    std::cin >> l >> r;
    long long counter = 0;
    //std::ofstream file_saver("patyczkow.csv");
    for (long long i = l; i <= r; i++)
    {
        long long number = i;
        while (true)
        {
            if (number == 0)
            {
                counter++;
                break;
            }
            if (number % 10 == 0 || i % (number % 10) != 0)
            {
                break;
            }
            number /= 10;
        }
        /*if (i % 100000000 == 0)
            std::cout << counter << " ";*/
        /*file_saver << counter;
        if (i != n - 1)
        {
            file_saver << ',';
        }*/
    }
    std::cout << counter;
    return 0;
}