Strange fuction—裸地三分
阿新 • • 發佈:2019-01-23
#include<stdio.h>
#include<iostream>
#include<algorithm>
#include<string.h>
#include<math.h>
using namespace std;
#define eps 1e-7
double poww(double x,double y)
{
double mm;
mm=6*pow(x,7)+8*pow(x,6)+7*pow(x,3)+5*pow(x,2)-y*x;
return mm;
}
int main()
{
int i,j;
int t;
double y,x;
double le,ri,mid,mmid;
double a,b;
while(scanf("%d",&t)!=EOF)
{
while(t--)
{
scanf("%lf",&y);
le=0;
ri=100;
while(fabs(le-ri)>=eps)
{
mid=(le+ri)/2;
mmid=(ri+mid)/2;
a=poww(mid,y);
b=poww(mmid,y);
if(a>b)
le=mid;
else ri=mmid;
}
printf("%.4lf\n",a);
}
}
}
#include<iostream>
#include<algorithm>
#include<string.h>
#include<math.h>
using namespace std;
#define eps 1e-7
double poww(double x,double y)
{
double mm;
mm=6*pow(x,7)+8*pow(x,6)+7*pow(x,3)+5*pow(x,2)-y*x;
return mm;
}
int main()
{
int i,j;
int t;
double y,x;
double le,ri,mid,mmid;
double a,b;
while(scanf("%d",&t)!=EOF)
{
while(t--)
{
scanf("%lf",&y);
le=0;
ri=100;
while(fabs(le-ri)>=eps)
{
mid=(le+ri)/2;
mmid=(ri+mid)/2;
a=poww(mid,y);
b=poww(mmid,y);
if(a>b)
le=mid;
else ri=mmid;
}
printf("%.4lf\n",a);
}
}
}