Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)
Total Submission(s): 5667 Accepted Submission(s): 2681
http://acm.hdu.edu.cn/showproblem.php?pid=2199
#include<iostream> #include<cstdio> #define sum(x) ((8*x*x*x*x)+(7*x*x*x)+(2*x*x)+(3*x)+(6)) using namespace std; int main() { int t; double y,mid,left,right; cin>>t; while(t--) { scanf("%lf",&y); left=0.0,right=100.0; if(y>=6.0&&y<=sum(100)) { while(right-left>1e-8) { mid=(left+right)/2.0; if(sum(mid)-y>1e-8) right=mid; else if(y-sum(mid)>1e-8) left=mid; else break; } printf("%.4lf\n",mid); } else puts("No solution!"); } return 0; }