模板(p3382)
#include<iostream>
#include<cstdio>
#include<cstring>
#include<string>
#include<algorithm>
#include<cctype>
#include<cmath>
#include<cstdlib>
#include<queue>
#include<ctime>
#include<vector>
#include<set>
#include<map>
#include<stack>
using namespace std;
const double eps = 1e-6;
int n;
double a[1100];
inline double f(double x){
double res=0;
for(int i=n;i>=0;i--)
res=res*x+a[i];
return res;
}
int main(){
double le,ri;
cin>>n>>le>>ri;
for(int i=n;i>=0;i--)scanf("%lf",&a[i]);
while(ri-le>eps){
double k=(ri-le)/3,mid1=le+k,mid2=ri-k;
if(f(mid1)>f(mid2))ri=mid2;
else le=mid1;
}
printf("%0.5lf
",le);
return 0;
}