#P7817. [RC-05] 迷失自我
[RC-05] 迷失自我
Description
For two digit strings consisting only of , if:
- The lengths of are both .
- The lexicographical order of is smaller than .
- For any and (, , where are integers, and the two intervals are different), let be the decimal number formed by arranging the characters of from position to in order, be the decimal number formed by arranging the characters of from position to in order, be the decimal number formed by arranging the characters of from position to in order, and be the decimal number formed by arranging the characters of from position to in order. Then .
Then is called an indistinguishable pair. For example, and are not an indistinguishable pair, because taking and , we have and , so .
Find how many indistinguishable pairs there are among length digit strings consisting only of . You only need to output the answer modulo .
Input Format
This problem has multiple test cases within a single test point.
The first line contains an integer , the number of test cases.
Each of the next lines contains one integer , the query.
Output Format
Output lines, each containing one integer: the answer for that test case modulo .
1
1
1
Hint
For all testdata, , .
The detailed Constraints are as follows:
| Test Point ID | Score | ||
|---|---|---|---|
Translated by ChatGPT 5
京公网安备 11011102002149号