搜索专题 第二个·
来源:互联网 发布:百度网盘总是网络异常 编辑:程序博客网 时间:2024/06/14 10:26
Strange fuction
Time Limit : 2000/1000ms (Java/Other) Memory Limit : 32768/32768K (Java/Other)
Total Submission(s) : 83 Accepted Submission(s) : 39
Problem Description
Now, here is a fuction:<br> F(x) = 6 * x^7+8*x^6+7*x^3+5*x^2-y*x (0 <= x <=100)<br>Can you find the minimum value when x is between 0 and 100.
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 only one real numbers Y.(0 < Y <1e10)
Output
Just the minimum value (accurate up to 4 decimal places),when x is between 0 and 100.
Sample Input
2<br>100<br>200
Sample Output
-74.4291<br>-178.8534
Author
Redow
题目大意
二分法也是
不过这个事导数哦!
要求导哦!!
嘿嘿
<pre name="code" class="cpp">#include<iostream>#include<string.h>#include<set>#include<stdio.h>#include<vector>#include<algorithm>#include<numeric>#include<math.h>#include<string.h>#include<sstream>#include<stdio.h>#include<string>#include<cstdlib>#include<algorithm>#include<iostream>#include<map>#include<queue>#include<string>#include<iomanip>using namespace std;double paopao(double x,double y){ return 42*x*x*x*x*x*x+48*x*x*x*x*x+21*x*x+10*x-y;}double pao123(double d,double o){ return 6*d*d*d*d*d*d*d+8*d*d*d*d*d*d+7*d*d*d+5*d*d-o*d;}int main(){ int n; cin>>n; int i; for(i=1;i<=n;i++) { double pao; cin>>pao; double max; double mix; double mid; max=paopao(100,pao); mix=paopao(0,pao); double x1=100; double x2=0; double t; while(1) { t=(x1+x2)/2; mid=paopao(t,pao); if(mid<0) { x2=t; } else { x1=t; } if(x1-x2<0.000000001) { break; } } double hege; hege=(x2+x1)/2; cout<<fixed<<setprecision(4)<<pao123(hege,pao)<<endl; } return 0;}
0 0
- 搜索专题 第二个·
- 第二专题总结(搜索算法)
- ACM第二专题—搜索总结
- 搜索专题
- 搜索专题
- 搜索专题
- 搜索专题
- GNU Makefile学习专题(二) | 第二个实例
- 2010暑期集训第二专题(搜索)关于搜索的一点两点三点...
- 第二专题总结
- 专题三 第二题
- 情境搜索专题访谈
- 搜索专题题目推荐
- 记忆化搜索专题
- hdu 搜索专题
- 【专题】二分搜索
- 搜索专题训练(2)
- 搜索专题之BFS
- 深度学习卷积神经网络大事件一览
- iOS学习笔记03-UITableView
- 87 智能指针(一)
- 搜索 第一题 二分问题
- 2006: [NOI2010]超级钢琴 ST表+优先队列
- 搜索专题 第二个·
- BestCoder Round #79 (div.2) hdu 5660 ,hdu 5661
- Google C++命名规范
- Tricks(三十一)—— 访问一个数组相邻的奇数位偶数位
- Unity之使用csv文件
- 2795: [Poi2012]A Horrible Poem hash
- 【1-3】pythondb增删改查
- 2179: FFT快速傅立叶 FFT
- 推荐!国外程序员整理的机器学习资源大全