HDU 2899 Strange fuction
来源:互联网 发布:win32 api编程 编辑:程序博客网 时间:2024/06/07 18:28
题目链接
题意 求出F(x) = 6 * x^7+8*x^6+7*x^3+5*x^2-y*x (0 <= x <=100)最小值。
分析 求出上诉式子的导数。极值点是一阶导数为零的时候 用二分法找出极值点。然后带入求出最小值。(数学比较渣,这句话好像是错的。 不管啦 反正就是这样的思路)
#include<iostream>#include<cstdio>#include<cmath>using namespace std;double y;double p(double x){ return 42*pow(x,6)+48*pow(x,5)+21*x*x+10*x-y;}int main (void){ int n; cin>>n; while(n--){ cin>>y; double low=0,high=100,mid; while(high-low>1e-8){ mid=(low+high)/2.0; if(p(mid)>=0) high=mid; else low=mid; } printf("%.4lf\n",6*pow(low,7)+8*pow(low,6)+7*pow(low,3)+5*low*low-y*low); } return 0;}
阅读全文
0 0
- HDU 2899 Strange fuction
- hdu 2899 Strange fuction
- hdu 2899 Strange fuction
- HDU 2899 Strange fuction
- hdu 2899 Strange fuction
- HDU 2899-Strange fuction
- hdu 2899 Strange fuction
- hdu--2899--Strange fuction
- hdu 2899 Strange fuction
- HDU 2899 Strange fuction
- HDU 2899 Strange fuction
- hdu 2899 Strange fuction
- hdu 2899 Strange fuction
- HDU 2899 Strange fuction
- HDU 2899 Strange fuction
- hdu 2899 Strange fuction
- Strange fuction ----HDU 2899
- hdu 2899 Strange fuction
- HDU6060RXD and dividing(思维+dfs)
- java实现从左到右打印二叉树
- git(十二)-git gc
- HDU 6033 Add More Zero
- [Visual Studio]Visual Studio使用问题
- HDU 2899 Strange fuction
- Android 特别的.9图片
- 配置SpringMVC项目
- 详解js跨域问题
- 底部导航栏
- Python学习(八)——map、reduce、filter、sorted
- 二次筛法找区间两点特别大(超过10亿)的素数-POJ2689
- 无名管道
- ccf认证Z字形扫描90分