#include <bits/stdc++.h>
using namespace std;
double y,ans;
double f(double x){
return 8*pow(x,4)+7*pow(x,3)+2*pow(x,2)+3*x+6;
}
double bsearch(double l,double r){
const double eps=1e-8;
while(l-r>eps){
double mid=(l+r)/2;
if(f(mid)>y) r=mid;
else l=mid;
}
return l;
}
int main(){
int t;
cin>>t;
while(t--){
int y;
cin>>y;
if(y<6||y>f(100)) cout<<"No solution!"<<endl;
else {
printf("%.4lf\n",bsearch(0,100));
}
}
return 0;
}
解方程(二分查找)
最新推荐文章于 2022-07-05 23:02:16 发布