No.881 Sum of sin(x)/x
Problem Statement
Find $$\sum_{i=0}^{n-1}\sum_{j=-\infty}^{\infty} a_i\mathrm{sinc}(x_i+j)$$.
Here, $$\mathrm{sinc}(x)=\begin{cases}
\frac{\sin(x)}{x} & (x \neq 0)\\
1 & (x = 0)
\end{cases}$$
.
Input
$n$
$x_0$ $a_0$
$x_1$ $a_1$
$\vdots$
$x_{n-2}$ $a_{n-2}$
$x_{n-1}$ $a_{n-1}$
$n$ is an integer. $x_i$, $a_i$ ($0 \leq i \leq n-1$) are real numbers (double-precision floating point).
$\begin{align}
0 & \leq n \leq 1000 \\
0 & \leq x_i \leq 2\pi \\
-1& \leq a_i \leq 1
\end{align}$
Output
Output the computed value. At least one of the absolute error and the relative error must be at most $10^{-7}$.
Sample
Sample 1
Input
10 4.340259014192165 0.5804850289201513 4.5962018217781955 0.9826444030410206 3.5102742577385135 -0.5795237689871118 1.189263521904466 0.4594381960068148 2.299623785805098 -0.08875304679510898 0.855709690583489 0.8608500528959087 2.0660276292365967 0.5437145864451949 1.0843384034923094 -0.5253594732722164 4.17299640448884 -0.6112627957798529 1.4949201982233347 -0.3614160097013439
Output
3.960973967504944
提出するには、Twitter 、GitHub、 Googleもしくは右上の雲マークをクリックしてアカウントを作成してください。
37zigen
QCFium