#P8926. 「GMOI R1-T3」Number Pair
「GMOI R1-T3」Number Pair
Problem Description
We define a pair of numbers that satisfies the following conditions as a "wonderful number pair":
, and (it is guaranteed that ).
There are test cases. For each test case, given three numbers , find the number of pairs that satisfy the conditions.
Output the answer modulo .
Input Format
This problem has multiple test cases.
The first line contains an integer , representing the number of test cases.
The next lines each contain three integers .
Output Format
For each test case, output the corresponding answer, one per line.
5
10 1 3
30 1 5
997 24 35
34 39 99
210 1000 1001
12
40
24
244
32
Hint
Note that the time limit is not usual.
For of the testdata: , , .
| Test Point | Total Score | ||||
|---|---|---|---|---|---|
This problem guarantees that is generated randomly, and there is no extreme testdata intended to make it difficult. The time limit has already been set to twice that of the standard solution, so please feel assured.
Translated by ChatGPT 5