#include<bits/stdc++.h>
using namespace std;
long p,q,r,s,t,u;
#define EPS 1e-7
double f(double x)
{
return p*exp(-x) + q*sin(x) + r*cos(x) + s*tan(x) + t*x*x + u;
}
double binary__search()
{
double low=0.0,high=1.0;
while(high>(low+EPS))
{
//cout<<low<<" "<<high<<endl;
double mid=(low+high)/2.0;
if(f(low)*f(mid)<=0)
{
high=mid;
}
else
low=mid;
}
return (low+high)/2;
}
main()
{
while(cin>>p>>q>>r>>s>>t>>u)
{
if(f(0)*f(1)>0)
{
printf("No solution\n");
}
else
{
printf("%.4f\n",binary__search());
}
}
}
using namespace std;
long p,q,r,s,t,u;
#define EPS 1e-7
double f(double x)
{
return p*exp(-x) + q*sin(x) + r*cos(x) + s*tan(x) + t*x*x + u;
}
double binary__search()
{
double low=0.0,high=1.0;
while(high>(low+EPS))
{
//cout<<low<<" "<<high<<endl;
double mid=(low+high)/2.0;
if(f(low)*f(mid)<=0)
{
high=mid;
}
else
low=mid;
}
return (low+high)/2;
}
main()
{
while(cin>>p>>q>>r>>s>>t>>u)
{
if(f(0)*f(1)>0)
{
printf("No solution\n");
}
else
{
printf("%.4f\n",binary__search());
}
}
}
কোন মন্তব্য নেই:
একটি মন্তব্য পোস্ট করুন