問題一覧 > 教育的問題

No.2971 Irrational Integral

レベル : / AI推定難易度 : 550 / 実行時間制限 : 1ケース 1.000秒 / メモリ制限 : 512 MB / スペシャルジャッジ問題 (複数の解が存在する可能性があります)
タグ : (AC するまで非表示) / 解いたユーザー数 55
作問者 : 👑 p-adic / テスター : hiro1729
お気に入りにしたユーザー ProblemId : 10067 / 自分の提出
問題文最終更新日: 2024-08-10 07:42:35
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
yukicoder contest 454 (順位表) の他の問題:

Note

The execution time limit for this problem is 1000[ms].

Problem Statement

A non-negative integer $N$ is given as input.

$\displaystyle \int_0^1 \sqrt{x^3 + N^3} \ dx $

Find the value of the above integral.

Input

The input is given from standard input in $1$ line in the following format:

  • Line $1$ contains $N$.
$N$

Constraints

The input satisfies the following constraints:

  • $N$ is an integer satisfying $0 \leq N \leq 10^3$.

Output

$\displaystyle \int_0^1 \sqrt{x^3 + N^3} \ dx $

Print the value of the above integral in decimal notation in $1$ line.

Print a newline at the end.

 

Note that this problem uses a special judge that allows decimal errors. Your answer is accepted if its absolute error from the approximation to $6$ decimal places of the exact answer is at most $10^{-3}$.

Here, the approximation to $6$ decimal places of a real number $x$ means the largest real number that does not exceed $x$ and has a finite decimal representation with at most $6$ digits after the decimal point.

Strictly follow the output format described above. For example, the behavior of the judge is not guaranteed if there are extra spaces.

Also, due to constraints on the judge side, your output must be at most $100$ characters.

Sample

Sample 1
Input
0
Output
0.4

The integrand $\sqrt{x^3 + N^3} = x^{\frac{3}{2}}$ has the antiderivative $\frac{2}{5} x^{\frac{5}{2}}$. Therefore,

$\displaystyle \int_0^1 \sqrt{x^3 + N^3} \ dx = \left[ \frac{2}{5} x^{\frac{5}{2}} \right]_0^1 = \frac{2}{5} \times 1^{\frac{5}{2}} - \frac{2}{5} \times 0^{\frac{5}{2}} = \frac{2}{5} = 0.4 $

holds. Besides this, printing

0.401

or

0.399

is also accepted, since the relative error is $2.5 \times 10^{-3} > 10^{-3}$ but the absolute error is $10^{-3}$. On the other hand, printing

0.4011

or

0.3989

is rejected, since the absolute error is $10^{-3} + 10^{-4} > 10^{-3}$.

Sample 2
Input
1
Output
1.111447

The approximation to $6$ decimal places of the integral is $1.111447$. Besides this, printing

1.110447

or

1.112447

is also accepted, since the absolute error is $10^{-3}$, but printing

1.1104469999999

or

1.1124470000001

is rejected, since the relative error is at most $10^{-3}$ but the absolute error is $10^{-3} + 10^{-10} > 10^{-3}$.

Sample 3
Input
2
Output
2.871864

The approximation to $6$ decimal places of the integral is $2.871864$.

提出するには、Twitter 、GitHub、 Googleもしくは右上の雲マークをクリックしてアカウントを作成してください。