#include<bits/stdc++.h>
using namespace std;
int main()
{
double a, b, sum, n, j, k, x, y;
int t, i;
cout << showpoint;
cout << fixed;
cout << setprecision(2);
while(cin >> n)
{
for(j=1;j<=n;j++)
{
cin >> t >> a >> b;
double c[t];
sum = 0;
k = t*2;
for(i=0;i<t;i++)
{
cin >> c[i];
sum = sum + (k * c[i]);
k = k-2;
}
x = t*a + b;
y = (x - sum)/(t+1);
cout << y << endl;
if(j != n)
cout << endl;
}
}
return 0;
}
using namespace std;
int main()
{
double a, b, sum, n, j, k, x, y;
int t, i;
cout << showpoint;
cout << fixed;
cout << setprecision(2);
while(cin >> n)
{
for(j=1;j<=n;j++)
{
cin >> t >> a >> b;
double c[t];
sum = 0;
k = t*2;
for(i=0;i<t;i++)
{
cin >> c[i];
sum = sum + (k * c[i]);
k = k-2;
}
x = t*a + b;
y = (x - sum)/(t+1);
cout << y << endl;
if(j != n)
cout << endl;
}
}
return 0;
}
Comments
Post a Comment