問題一覧 > 通常問題

No.347 Differentiation and Integration

レベル : / AI推定難易度 : 171 / 実行時間制限 : 1ケース 5.000秒 / メモリ制限 : 512 MB / 小数誤差許容問題 絶対誤差または相対誤差が $10^{-4}$ 以下。ただし、ジャッジ側の都合で500桁未満にしてください
タグ : (AC するまで非表示) / 解いたユーザー数 222
作問者 : 小指が強い人
お気に入りにしたユーザー ProblemId : 836 / 自分の提出
問題文最終更新日: 2026-06-27 03:12:33
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 132 (順位表) の他の問題:

Problem Statement

The following function $f(x)$ is given.
$f(x)=x^{a_1}+x^{a_2}+\dots+x^{a_{N-1}}+x^{a_N}$
Given a constant $B$, find the value $f'(B)$ of the derivative of the expression with respect to $x$, and,
writing the indefinite integral of the expression as $F(x)+C={\int}f(x)dx$, the value of $F(B)$.
(Here, $C$ is the constant part, including the constant of integration.)

However, the indefinite integral F in this problem is a function that satisfies $F'=f$ and can be expressed as a linear combination of $\log(x)$ and $x^r(r \ne 0)$.

Note

High school mathematics knowledge is required.

Input

The first line gives the number of $a_i$.
The second line gives the constant $B$.
The third line gives the values of $a_i$.

$N$
$B$
$a_1\ a_2\dots a_{N-1}\ a_N$

$1 \le N \le 10$ (integer)
$1 \le B \le 10$ (integer)
$-5.0 \le a_i \le 5.0$ (real number with one digit after the decimal point)
$(i=1\dots N)$

Output

$X_1$
$X_2$

Output $f'(B)$ as $X_1$ and $F(B)$ as $X_2$.
The inputs are prepared so that the absolute values are neither too large nor too small, so simply output them as they are without hesitation.
A relative error of up to $10^{-4}$ is allowed.
Print a newline at the end.

Sample

Sample 1
Input
4
2
1.0 2.0 3.0 4.0
Output
49.0
15.066666666666666

The original function is $f(x)=x^1+x^2+x^3+x^4$, so
the derivative is $f'(2)=2^0+2×2^1+3×2^2+4×2^3=49.0$
and the integral is $F(2)=1/2×2^2+1/3×2^3+1/4×2^4+1/5×2^5=15.0666...$

Sample 2
Input
10
10
-5.0 2.2 4.6 5.0 -1.0 2.0 0.5 0.3 -3.9 1.5
Output
68372.74882983962
238751.0685480203

Sample 3
Input
2
2
0.0 -1.0
Output
-0.25
2.6931471805599454

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