#include <stdio.h>
#include <math.h>
double f(double x)
{
return 8*pow(x,4)+7*pow(x,3)+2*pow(x,2)+3*x+6;
}
int main(int argc, char *argv[])
{
int n;
double y;
double l,r,m;
scanf("%d",&n);
while(n--)
{
scanf("%lf",&y);
if(f(0)<=y&&f(100)>=y)
{
l=0;
r=100;
while(r-l>1e-6) //高精度
{
m=(l+r)/2;
if(f(m)>y)
r=m;
else if(f(m)<y)
l=m;
}
printf("%.4lf\n",r);
}
else
printf("No solution!\n");
}
return 0;
}
HDU 2199
猜你喜欢
转载自blog.csdn.net/Beverley_Y/article/details/83317882
今日推荐
周排行