#P2567. [SCOI2010] 幸运数字

    ID: 1584 远端评测题 1000ms 125MiB 尝试: 0 已通过: 0 难度: 7 上传者: 标签>2010四川各省省选深度优先搜索,DFS剪枝容斥

[SCOI2010] 幸运数字

Description

In China, many people consider 66 and 88 to be lucky numbers. lxhgww thinks so too, so he defines his own "lucky numbers" as those whose decimal representation contains only the digits 66 and 88. For example, 6868, 666666, and 888888 are all "lucky numbers". However, there are too few such "lucky numbers"; for instance, in the interval [1,100][1,100] there are only 66 of them (66, 88, 6666, 6868, 8686, 8888). Therefore, he further defines "almost lucky numbers": any multiple of a "lucky number" is an "almost lucky number". Of course, any "lucky number" is also an "almost lucky number". For example, 1212, 1616, and 666666 are all "almost lucky numbers".

Now lxhgww wants to know how many "almost lucky numbers" there are in a closed interval [a,b][a, b].

Input Format

The input is a single line containing 22 numbers aa and bb.

Output Format

Output a single line containing 11 number, the count of "almost lucky numbers" in the closed interval [a,b][a, b].

1 10
2

Hint

For 30%30\% of the testdata, it is guaranteed that 1ab1061 \le a \le b \le 10^6.

For 100%100\% of the testdata, it is guaranteed that 1ab10101 \le a \le b \le 10^{10}.

Translated by ChatGPT 5