P3338 [ZJOI2014] Force
Description
Given $n$ numbers $q_1,q_2, \dots q_n$, define
$$F_j~=~\sum_{i = 1}^{j - 1} \frac{q_i \times q_j}{(i - j)^2}~-~\sum_{i = j + 1}^{n} \frac{q_i \times q_j}{(i - j)^2}$$
$$E_i~=~\frac{F_i}{q_i}$$
For $1 \leq i \leq n$, find the value of $E_i$.
Input Format
The first line contains an integer $n$.
Each of the following $n$ lines contains a real number. The number on the $(i+1)$-th line represents $q_i$.
Output Format
Output $n$ lines, each containing a real number. The number on the $i$-th line represents $E_i$.
Your output is considered correct if it differs from the standard answer by at most $10^{-2}$.
Explanation/Hint
Constraints
For $30\%$ of the testdata, $n \leq 1000$.
For $50\%$ of the testdata, $n \leq 6 \times 10^4$.
For $100\%$ of the testdata, $1 \leq n \leq 10^5$, $0 < q_i < 10^9$.
Translated by ChatGPT 5