#include<stdio.h>
#include<math.h>
double cha(double x)
{
return 8*pow(x,4) + 7*pow(x,3) + 2*pow(x,2) + 3*x + 6;
}
int main()
{
int t;
double left,right,mid;
scanf("%d",&t);
int y;
while(t--)
{
scanf("%d",&y);
left=1.0;
right=100.0;
if(y<cha(left)||y>cha(100))
{
printf("No solution!\n");
continue ;
}
while((right-left)>1e-6)
{
mid=(left+right)/2;
if(cha(mid)<=y)
left=mid;
else right=mid;
}
printf("%.4lf\n",(left+right)/2);
}
return 0;
}
杭电2199-----二分法
猜你喜欢
转载自taoyongpan.iteye.com/blog/2257720
今日推荐
周排行