//浮点二分
#include<iostream>
#include<cmath>
using namespace std;
double f(double x)
{
return (double)(8*pow(x,4.0)+7*pow(x,3.0)+2*pow(x,2.0)+3*pow(x,1.0)+6);
}
int main()
{
int t,i,j,k;
double y,first,last,mid;
cin>>t;
while(t--)
{
cin>>y;
if(f(0)<=y&&f(100)>=y)
{
first=0;last=100;
while(last-first>1e-6)
{
mid=(first+last)/2;
double ans=f(mid);
if(ans>y)
last=mid-1e-7;
else
first=mid+1e-7;
}
printf("%.4f\n",(first+last)/2);
}
else
printf("No solution!\n");
}
return 0;
}
poj --2199
最新推荐文章于 2018-04-08 12:15:07 发布