Now,given the equation 8*x^4 + 7*x^3 + 2*x^2 + 3*x + 6 == Y,can you find its solution between 0 and 100;
Now please try your lucky.
Now please try your lucky.
Input
The first line of the input contains an integer T(1<=T<=100) which means the number of test cases. Then T lines follow, each line has a real number Y (fabs(Y) <= 1e10);OutputFor each test case, you should just output one real number(accurate up to 4 decimal places),which is the solution of the equation,or “No solution!”,if there is no solution for the equation between 0 and 100.
Sample Input
2 100 -4Sample Output
1.6152 No solution!
by talk:这个方程在0-100是递增的,是有序的,然后我们来用二分法来解决问题,定一个左端点left=0,与右端点right=100。
通过二分法,区间的中值mid=(left+right)/2。将中值不断带入函数计算,若求出的值比y大,则取左半区间,反之,在右半区间,如此循环直到精确10位小数。(其实不需要精确到10,233)然后最后一个mid就是索求答案。才学到1e10是10^10,1e-10是10^(-10).
w(゚Д゚)w。

本文介绍了一种使用二分法求解特定区间内多项式方程的方法。通过对给定方程8*x^4+7*x^3+2*x^2+3*x+6=Y在0至100区间内的解进行搜索,详细阐述了二分法的具体步骤与应用。文章还提到了一些关键概念,如1e10表示10的10次方。

5695

被折叠的 条评论
为什么被折叠?



