题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=2899
#include<stdio.h>
#include<math.h>
double F(double x,double y)
{
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 f(double x,double y)
{
return 42*x*x*x*x*x*x+48*x*x*x*x*x+21*x*x+10*x-y;
}
int main()
{
int t;
scanf("%d",&t);
while(t--)
{
double y;
scanf("%lf",&y);
double l=0.0,r=100.0;
double mid=(l+r)/2;
while(fabs(f(mid,y))>1e-5)
{
if(f(mid,y)>0)
r=mid;
else
l=mid;
mid=(l+r)/2;
}
printf("%.4lf\n",F(mid,y));
}
return 0;
}