#include<iostream>
#include<iomanip>
using namespace std;
class myitem
{
public:
double item_x;
double item_const;
myitem Mul(double a)
{
myitem m;
m.item_const = a * this->item_const;
m.item_x = a * this->item_x;
return m;
}
myitem Add(double a)
{
myitem m;
m.item_const = a + this->item_const;
m.item_x = this->item_x;
return m;
}
myitem Sub(myitem a)
{
myitem m;
m.item_const = this->item_const - a.item_const;
m.item_x = this->item_x - a.item_x;
return m;
}
};
int main()
{
//i=1,2,3,4,5,6
int n = 0;cin>>n;
myitem a[n+2];
double input;
cin>>input;
a[0].item_x = 0;
a[0].item_const = input;
cin>>input;//结果
a[1].item_x = 1;
a[1].item_const= 0;
double c[n+1];
for(int i = 1;i<n+1;i++)
cin>>c[i];
for(int i = 2;i<n+2;i++)
{
a[i] = a[i-1].Mul(2.0).Add(2.0*c[i-1]).Sub(a[i-2]);
}
cout<<fixed<<setprecision(2)<<(input-a[n+1].item_const)/a[n+1].item_x;
return 0;
}
0.0分
0 人评分
C语言程序设计教程(第三版)课后习题6.9 (C语言代码)浏览:524 |
A+B for Input-Output Practice (VI) (C++代码)浏览:445 |
回文串 (C语言代码)浏览:3103 |
多输入输出练习1 (C语言代码)浏览:1220 |
C语言程序设计教程(第三版)课后习题7.2 (C语言代码)浏览:818 |
C语言程序设计教程(第三版)课后习题10.3 (C语言代码)浏览:566 |
蛇行矩阵 (C语言代码)浏览:607 |
P1000 (C语言代码)浏览:911 |
1124题解浏览:630 |
简单的a+b (C语言代码)浏览:618 |