#P1611. 循环的数字
循环的数字
Description
Have you ever felt bored with a TV program because you kept seeing the same thing repeat over and over? Well, I do not really care about TV shows, but sometimes numbers also cycle like that.
Assume two distinct positive integers are cyclic if and only if you can move some digits from the end of to the front, without changing the order of the moved digits, so that the whole number becomes . For example, is a cyclic pair because you can move the trailing of in front of to get . Note that to be a cyclic pair, and must have the same number of digits. Neither nor has leading zeros.
Now given positive integers and , guaranteed to have the same number of digits and no leading zeros, count the number of cyclic pairs such that .
Input Format
This problem has 10 test points. Each input file contains 1 line. The first line contains two space-separated positive integers A and B.
Output Format
Each output file should contain a single integer x, representing the number of cyclic pairs such that .
1111 2222
287
Hint
.
Translated by ChatGPT 5
京公网安备 11011102002149号