#P7328. 「MCOI-07」Dream and Machine Learning
「MCOI-07」Dream and Machine Learning
Description
Dream built a redstone computer to verify formulas of the form .
Dream fixed and , and constructed pairs of positive integers that satisfy the condition above.
Unfortunately, Dream forgot the exact value of . Now he gives you and these pairs. Please replace Dream's computer and answer queries of the form .
Input Format
The first line contains three positive integers, representing , , and .
The next lines each contain two positive integers, representing a pair and .
The next lines each contain one positive integer, representing an .
Output Format
Output lines, each being the answer to the corresponding query.
3 8 3
108 75
616 36
220 16
37 66
114 64
514 24
1919 65
810 33
19260817
123456789
23333333
3
79
49
请见附件 sample.in
请见附件 sample.out
Hint
Explanation for Sample 1
You can uniquely determine that .
Sample 1 only explains the problem statement, and does not represent any test point of any subtask.
Constraints
This problem uses bundled testcases.
- Subtask 1 (5 pts):
- Subtask 2 (19 pts):
- Subtask 3 (19 pts):
- Subtask 4 (19 pts):
- Subtask 5 (19 pts):
- Subtask 6 (19 pts):
For of the testdata, , , , and .
It is guaranteed that is a prime number.
It is guaranteed that all are pairwise distinct.
It is guaranteed that the testdata is random.
Translated by ChatGPT 5
京公网安备 11011102002149号