UVA-10014

//递推
//见https://blog.csdn.net/accelerator_/article/details/9636923
#include <iostream>
#include <cstdio>
#include <cstring>
#include <string>
#include <cmath>
#include <cctype>
#include <algorithm>
#include <sstream>
#define EPS 1e-6
using namespace std;
int main(){
    long long n,x;
    double a0,an1,c[3001],s;
    cin>>x;
    while (x--)
    {
        s=0;
        cin>>n>>a0>>an1;
        for(int i=1;i<=n;i++)
            cin>>c[i];
        for(int i=0;i<n;i++){
            s+=c[i+1]*(n-i);
        }
        double aa=(an1-2*s+n*a0)/(n+1);
        printf("%.2f\n",aa);
        if(x!=0) printf("\n");
    }
    return 0;
}

 

posted @ 2020-06-06 20:39  西伯利亚挖土豆  阅读(130)  评论(0编辑  收藏  举报