Problem Description
Description
Let’s do a really easy math problem, so Mom no longer has to worry about us failing math.
Now you are given an equation A[i] = (A[i-1]+A[i+1])/2 - c[i](1 <= i <= n);, and then you are given A[0] and A[n+1]
Find A[1] = ?.
Input
Contains multiple test cases.
For each instance, the first line contains a positive integer n(1 <= n <= 3000), the second line contains two real numbers A[0], A[n+1], and each of the following lines contains a real number c[i](1 <= i <= n).
Output
For each test case, output the required a1 in one line (keep 2 decimal places).
Sample Input
| |
Sample Output
| |
Problem Analysis
This is a problem that takes some thought.
According to the formula:
we can obtain:
Therefore:
…
Thus we can get
From this, the result can be obtained directly
| |
Problem link: ZZULI [1841] so easy! Mom no longer has to worry about my math!