#P4834. Expected Energy Release in an Electric Field
Expected Energy Release in an Electric Field
Expected Energy Release in an Electric Field
Consider an electric field formed by n point charges. Each point charge generates a uniform electric field rather than the typical point-charge field. The electric field strength generated by the i-th charge is given by \(E_i = i\). A negatively charged test particle is placed in the field. Once it touches any one of the point charges, it fuses with that charge releasing a huge amount of energy.
The attraction force exerted by the i-th point charge is proportional to its field strength. Assume that the smallest charge exerts a force \(F\), then the i-th charge exerts a force of \(iF\). If the probability of the test charge touching the smallest point charge is \(P\), then the probability of touching the i-th point charge is \(iP\). Note that the sum of probabilities is \(\sum_{i=1}^{n} iP = P\,\frac{n(n+1)}{2}=1\), so \(P = \frac{2}{n(n+1)}\).
When the test charge touches the i-th point charge, the energy released is \(\mathrm{Fib}(E_i)\), where \(\mathrm{Fib}(\cdot)\) denotes the Fibonacci number (with \(\mathrm{Fib}(1)=1\), \(\mathrm{Fib}(2)=1\), and \(\mathrm{Fib}(n)=\mathrm{Fib}(n-1)+\mathrm{Fib}(n-2)\) for \(n \geq 3\)).
Your task is to compute the expected energy release, which is given by the formula:
[ \text{Expected Energy} = \frac{2}{n(n+1)} \sum_{i=1}^{n} i \cdot \mathrm{Fib}(i). ]
Good luck!
inputFormat
The input consists of a single integer n
representing the number of point charges (\(n \ge 1\)).
outputFormat
Print the expected energy release. The answer should be printed as a floating-point number rounded to 6 decimal places.
sample
1
1.000000