#P6601. 「EZEC-2」机器
「EZEC-2」机器
Description
A gravity machine consists of a smooth circular track and holes (the holes are numbered counterclockwise from to . The measure of the minor arc between every two adjacent holes is ). Each hole is connected by a passage to the hole whose angle with it is . For example, when , hole is connected to hole .
When , the structure is roughly like this:

Now we place a ball at hole , making it always move counterclockwise in uniform circular motion. Without teleportation, each second it can move from one hole to the next adjacent hole exactly.
Due to the strange structure of the future laboratory (the internal gravity-supplying device is incredible), each time it passes a hole, there is a probability that it teleports immediately (i.e., without spending time) to the hole on the other side of the passage, and then continues the counterclockwise uniform circular motion. That is, there is a probability that it continues moving along the circle to the next hole.
Note that at each unit of time, the ball can teleport at most once.
In simple terms, if at some time the ball is at hole , then at the next time it may move to hole or , with probabilities and , respectively.
Now tlx has two identical gravity machines, and two balls start moving from hole at the same time. He will randomly (all possible choices are equally likely) choose an ordered pair $( 1\leqslant i\leqslant 2n,0\leqslant j\leqslant t,i,j\in \mathbb Z )$, representing the hole number and the time, respectively. You need to find the probability that at time , in both gravity machines, hole simultaneously has a ball staying there (passing through the hole but teleporting to the opposite side does not count as staying).
Note: the ball may also teleport to the opposite hole right when it starts moving.
For convenience of calculation, we specify that all probabilities are considered modulo .
Input Format
The input contains one line with three integers , representing half the number of holes in the device, the teleportation probability taken modulo , and the upper bound of the time range for the random choice.
Output Format
Output one line with one integer, representing the required probability modulo .
2 500000004 1
125000001
6 114514 11
756497239
Hint
Constraints and Conventions
This problem uses bundled testdata.
The scoring is as follows:
- Subtask ( points): .
- Subtask ( points): .
- Subtask ( points): .
- Subtask ( points): .
- Subtask ( points): .
- Subtask ( points): .
- Subtask ( points): no special constraints.
For of the testdata, , , .
Note: any constraints not explicitly stated are the maximum constraints.
Sample Explanation #1
is modulo .
For convenience below, let be the probability when the chosen ordered pair is .
All ordered pairs with non-zero probability are: $P(1,0)=\dfrac{1}{4},P(3,0)=\dfrac{1}{4},P(2,1)=\dfrac{1}{4},P(4,1)=\dfrac{1}{4}$.
All possible ordered pairs are: , a total of choices.
So the total probability is:
$$P=\dfrac{1}{8}×\dfrac{1}{4}×4+\dfrac{1}{8}×0×4=\dfrac{1}{8}$$Modulo , it is , which is the output answer.
Other Hints
-
If you do not understand taking fractions modulo, you can see here.
-
If you do not understand how angles are represented in this problem, you can see radian measure.
Translated by ChatGPT 5
京公网安备 11011102002149号