#P4834. 萨塔尼亚的期末考试
萨塔尼亚的期末考试
Description
This problem is as follows:
There is an electric field formed by point charges. Assume each point charge produces a uniform electric field rather than a point-charge field, and the -th point charge has field strength .
Now place a negatively charged test charge in this field. As soon as the test charge touches any point charge, it will "fuse" with that point charge and release a huge amount of energy.
Because the field strengths produced by the point charges differ, the test charge is attracted to each point charge with different force; the stronger the attraction a point charge exerts on the test charge, the greater the probability of being drawn to that point charge, and the probability is proportional to the attraction.
Assume the smallest point charge exerts attraction on the test charge. Then another point charge exerts . Suppose the probability of touching the smallest point charge is . Then the probability for each point is . After touching a point charge, the released energy is .
Find the expected released energy.
The good news is that as long as she gets points on this problem, Satania will pass!
Input Format
The first line contains an integer , the number of test cases.
Each of the next lines contains an integer , the number of point charges.
Output Format
For each query, output one integer representing the expected energy. To avoid precision issues, please output the answer modulo .
1
2
1
Hint
- Sample Explanation
$\dfrac{1}{3}\times \mathrm{Fib}(1)+\dfrac{2}{3}\times \mathrm{Fib}(2)=1$.
Please read the problem carefully along with the sample.
-
Constraints
-
For of the testdata, , .
-
For of the testdata, , .
-
For of the testdata, , .
-
For of the testdata, , , and it is guaranteed that and .
is the Fibonacci sequence.
$$\mathrm{Fib}(i)=\begin{cases} 1 & i\le 2 \cr \mathrm{Fib}(i-1)+\mathrm{Fib}(i-2) & i > 2 \end{cases}$$Translated by ChatGPT 5
京公网安备 11011102002149号