#P3413. SAC#1 - 萌数
SAC#1 - 萌数
Description
The newbie SOL thinks numbers are cute!
Fortunately, not all numbers are cute in his eyes. A number is cute if and only if there exists a palindromic substring of length at least —that is, 101 is cute because 101 itself is a palindrome; 110 is cute because it contains the palindromic substring 11; but 102 is not cute, and 1201 is not cute.
Now SOL wants to know how many cute numbers there are among all integers from to .
Since the answer may be large, output the answer modulo ().
Input Format
The input contains a single line with two integers: and .
Output Format
Output a single line containing one integer, the answer.
1 100
10
100 1000
253
Hint
Let be the number of digits of in base .
For of the testdata, . For of the testdata, . For of the testdata, . For all the testdata, , .
2024/2/4: One set of hack testdata was added.
Translated by ChatGPT 5
京公网安备 11011102002149号