#P5553. 电学实验
电学实验
Description
In physics class, Xiao L and Xiao K are doing an electrical experiment: “Exploring the relationship between the current through a resistor and the resistance value when the voltage across the resistor is fixed.” In this experiment, they keep the voltage across the resistance box at , and adjust the knob to change the resistance of the box to $1 ~ \Omega , 2 ~ \Omega , 3 ~ \Omega , \ldots , n ~ \Omega$. They then read the corresponding current values as $1 ~ A, \dfrac 1 2 ~ A , \dfrac 1 3 ~ A , ... ,\dfrac 1 n ~ A$.
When describing the experimental conclusion, Xiao L and Xiao K disagree.
Xiao K: “As everyone knows, when the voltage across a resistor is fixed, the current through the resistor is inversely proportional to the resistance. That is, if the voltage across the resistance box stays unchanged and the resistance is , then the current through it is .”
Xiao L: “But why can’t we use a curve of degree at most to fit it?”
To correct Xiao L’s misunderstanding, Xiao K decides to first let Xiao L compute according to his own conclusion the current through the resistance box when its resistance is , and then perform an experiment to check whether the answer is correct. Meanwhile, to make Xiao L realize his mistake more deeply, Xiao K decides to do multiple experiments, each with a different .
However, when Xiao L tries to find the degree at most curve for these experimental data points, he runs into difficulties. Xiao L does not want to manually compute this curve and its value at , so he asks you to compute this value.
To make calculations easier, Xiao L converts all data into integers under modulo , and your output should also be this integer value. However, sometimes there are too many data points, causing the experimental data or the final computed result to be meaningless. In this case, you should output -1.
Input Format
The first line contains an integer , indicating that experiments were conducted.
Each experiment consists of one line containing an integer .
Output Format
For each experiment, output according to Xiao L’s conclusion the current value when the resistance box has resistance . If the experimental data or the computed result is not defined under the modulo meaning, output -1.
3
1
2
998244853
1
0
-1
Hint
For of the testdata, .
For of the testdata, .
For of the testdata, .
For of the testdata, .
For of the testdata, .
Translated by ChatGPT 5
京公网安备 11011102002149号