#P10664. BZOJ3328 PYXFIB
BZOJ3328 PYXFIB
Problem Description
Given integers , compute the value of the following expression modulo :
$$\sum_{i=0}^{\lfloor \frac{n}{k} \rfloor} C_n^{i\times k}\times F_{i\times k}$$Where:
- is a prime number, and the remainder of divided by is .
- denotes the binomial coefficient, i.e. .
- denotes the Fibonacci sequence, i.e. , , .
Input Format
The first line contains a positive integer , the number of test cases.
The next lines each contain three positive integers .
Output Format
Output lines, each containing one integer, which is the result.
1
1 2 3
1
Hint
For of the testdata, it is guaranteed that , , , , is a prime number, and the remainder of divided by is .
Translated by ChatGPT 5