No.454 Sum of Inverse Squares
問題文最終更新日: 2026-06-25 13:05:49
English (AI translation)
This statement was translated by AI (claude-opus-5-5, effort medium) and may contain errors or differ in nuance from the original. The original statement takes precedence.
Back to the original
Advent Calendar Contest 2016
(順位表)
の他の問題:
This problem is the Day 5 problem of Advent Calendar Contest 2016.
Problem Statement
There is a famous formula $\sum_{n=1}^{\infty} 1 / n^2 = \pi^2/6$. Now,
given a non-negative real number $x$, compute the limit of the series $\sum_{n=1}^{\infty} 1 / (x+n)^2$.
An absolute or relative error of up to $10^{-9}$ is allowed.
Input
$x$
$0 \le x \le 1000$
Output
Output the limit of the series in question on one line. Print a newline at the end.
Sample
Sample 1
Input
0
Output
1.6449340668482426
$\pi^2/6 = 1.6449340668482264\cdots$. An error of $10^{-9}$ or less is allowed.
Sample 2
Input
1.5
Output
0.490357756100235
Sample 3
Input
1000
Output
0.0009995001666667166
提出するには、Twitter 、GitHub、 Googleもしくは右上の雲マークをクリックしてアカウントを作成してください。
37zigen