标签:
#include <iostream>
#include<stdio.h>
#include<math.h>
using namespace std;
const double eps = 1e-6;
double cal(double x){
return 42*pow(x,6.0)+48*pow(x,5.0)+21*pow(x,2.0)+10*x;
}
double get(double x,double y){
return 6*pow(x,7)+8*pow(x,6)+7*pow(x,3)+5*pow(x,2)-x*y;;
}
int main()
{
int T = 0;
double Y = 0.0;
double x = 0.0;
cin >> T;
while(T--){
cin >> Y;
double res = 0.0;
double low = 0.0;
double high = 100.0;
while(high - low > eps){
x = (high + low)/2;
res = cal(x);
if(res < Y){
low = x + 1e-8;
}
if(res > Y){
high = x - 1e-8;
}
}
double value = get(x,Y);
printf("%.4f\n",value);
}
return 0;
}
标签:
原文地址:http://www.cnblogs.com/2016zhanggang/p/5410548.html