杭电 HDU ACM Strange fuction

#include<iostream>#include<stdio.h>#include<math.h>using namespace std;double y;double A(double x){return 42*pow(x,6)+48*pow(x,5)+21*pow(x,2)+10*x;}int main(){int T;cin>>T;while(T–){double low=0.0;double high=100.0;double mid;cin>>y;if(A(100)<y){printf("%.4lf",6*pow(100,7)+8*pow(100,6)+7*pow(100,3)+5*pow(100,2)-y*100);continue;}while(low+1e-8<high){mid=(low+high)/2.0;if(A(mid)>y)high=mid;elselow=mid;}printf("%.4lf\n",6*pow(low,7)+8*pow(low,6)+7*pow(low,3)+5*pow(low,2)-y*low);}return 0;}

,你不勇敢,没人替你坚强!

杭电 HDU ACM Strange fuction

相关文章:

你感兴趣的文章:

标签云: