#P3169. [CQOI2015] 多项式
[CQOI2015] 多项式
Description
After learning the binomial theorem, the math teacher gave a problem: given integers and (), find the expressions for () such that:
The students quickly worked out the answer. Seeing everyone finish so fast, the teacher assigned an even more brutal task: compute the specific value of some . Then the teacher wrote the values of on the blackboard. Since there were too many to write out, the teacher only provided a recurrence for and asked the students to compute it themselves:
$$a_k= \begin{cases} (1234\cdot a_{k-1}+5678)\bmod 3389 & k\gt 0 \\ 1 & k=0 \\ \end{cases}$$As someone learning competitive programming, you feel this homework is not suitable for manual calculation, so you start coding.
Input Format
The input consists of three lines. The first line contains a positive integer . The second line contains a non-negative integer . The third line contains a non-negative integer .
Output Format
Output one line containing the value of .
3
2
2
10536
Hint
Constraints:
- For 20% of the testdata, .
- For another 30% of the testdata, .
- For 100% of the testdata, , , .
Translated by ChatGPT 5
京公网安备 11011102002149号