No.3362 Integral!!!
タグ : / 解いたユーザー数 58
作問者 :
noya2
Koi
Problem Statement
You are given a non-negative integer $N$ and a sequence $K_0,K_1,K_2,\dots,K_N$.
This represents the following polynomial function of $x$.
$f(x)=K_0x^0+K_1x^1+K_2x^2+\dots +K_ix^i+\dots +K_Nx^N$
You are given integers $A,B\ (A\le B)$. Let $X$ be the value of the definite integral of $f(x)$ over the interval $[A,B]$. Output $\lfloor X\rfloor$.
Constraints
- $N,A,B,K_i$ are all integers
- $0 \le N \le 10$
- $-10 \le A \le B \le 10$
- $-10^5 \le K_i \le 10^5\ (0\le i\le N)$
Input
$N$ $A$ $B$ $K_0$ $K_1$ $K_2$ $\vdots$ $K_N$
Output
Output $\lfloor X\rfloor$ as an integer.
Sample
Sample 1
Input
2 0 1 1 2 1
Output
2
The definite integral of $x^2+2x+1$ over $[0,1]$ is $7/3=2.3333\dots$.
Since $\lfloor 2.3333\dots \rfloor=2$, output $2$.
Sample 2
Input
5 -1 1 0 0 0 0 0 1
Output
0
Sample 3
Input
0 0 1 9999
Output
9999
提出するには、Twitter 、GitHub、 Googleもしくは右上の雲マークをクリックしてアカウントを作成してください。