#include<cstdio>
#include<cstring>
#include<iostream>
#include<algorithm>
#include<cmath>
using namespace std;
double x,y;
double fx(double x,double y)
{
return 6*pow(x,7)+8*pow(x,6)+7*pow(x,3)+5*pow(x,2)-y*x;
}
double ffx(double x,double y)
{
return 42*pow(x,6)+48*pow(x,5)+21*pow(x,2)+10*x-y;
}
int main()
{
int t,n;
scanf("%d",&t);
while(t--)
{
scanf("%d",&n);
double l=0.0,r=100.0;
double mid;
while(r-l>1e-10)
{
mid=(r+l)/2;
if(ffx(mid,n)>0)
{
r=mid;
}
else
{
l=mid;
}
}
printf("%.4f\n",fx(mid,n));
}
return 0;
}
H - Strange fuction
最新推荐文章于 2024-11-04 23:11:51 发布