样例输入1
1 50.50 25.50 10.15
样例输出1
27.85
样例输入2
2 -756.89 52.52 172.22 67.17
样例输出2
-761.49
#include <iostream>
#include <stdio.h>
using namespace std;
double x[1010];
double C[1010];
int main()
{
int n;
cin >> n;
double sum= 0,A0,An1;
cin >> A0 >> An1;
x[0]= A0;
x[1]= 0;
for (int i= 1; i <= n; ++i)
{
cin >> C[i];
x[i + 1]= 2.0 * x[i]- x[i- 1] + 2.0 * C[i];
}
double ans= (An1- x[n + 1]) /(n + 1);
printf("%.2lf\n",ans);
return 0;
}