三分答案这东西,非常好理解
#include<iostream>
#include<cstdio>
#include<algorithm>
using namespace std;
int n;
double y;
double xz=1e-7;//修正精度
double lm,rm;
double v(double x){
return 6*x*x*x*x*x*x*x+8*x*x*x*x*x*x+7*x*x*x+5*x*x-y*x;
}
double sf(double l,double r){
while(l+xz<r){
lm=l+(r-l)*0.3;//这个数随便选
rm=l+(r-l)*0.7;
if(v(lm)<v(rm))
r=rm;
else
l=lm;
}
return v(l);
}
int main(){
cin>>n;
for(int i=1;i<=n;++i){
scanf("%lf",&y);
printf("%.4lf
",sf(0.0,100.0));
}
}