Strange fuction

Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)
Total Submission(s): 4803    Accepted Submission(s): 3428

Problem Description
Now, here is a fuction:
  F(x) = 6 * x^7+8*x^6+7*x^3+5*x^2-y*x (0 <= x <=100)
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
100
200
 
Sample Output
-74.4291
-178.8534
 
Author
Redow
题意:给一式子,还有变量范,0-100,让求最小值,。导数等于0时,二分查找导数等于0的时候的x~我怎么把二分这么重要的查找方式给忘了呢,当时还在想这x是实数怎么找啊~蠢到猪
 #include<iostream>
#include<cstdio>
#include<cstring> using namespace std; double y; double slove(double x)
{
return 42.0*x*x*x*x*x*x+48.0*x*x*x*x*x+21.0*x*x+10.0*x-y;
}
double get(double x)
{
return 6.0*x*x*x*x*x*x*x+8.0*x*x*x*x*x*x+7.0*x*x*x+5.0*x*x-y*x;
} int main()
{
int t;
scanf("%d", &t);
while(t--)
{
scanf("%lf", &y);
double l = 0.0, r = 100.0;
while(r-l >= 1e-) // double 比较,不能写成 r > l
{
double mid = (l+r)/;
if(slove(mid) > )
r = mid;
else
l = mid;
}
printf("%.4f\n", get(l));
}
return ;
}

蠢成猪肿么办~

Strange fuction hdu 2899的更多相关文章

  1. (二分搜索 )Strange fuction -- HDU -- 2899

    链接: http://acm.hdu.edu.cn/showproblem.php?pid=2899 Time Limit: 2000/1000 MS (Java/Others)    Memory ...

  2. hdu 2899 Strange fuction

    http://acm.hdu.edu.cn/showproblem.php?pid=2899 Strange fuction Time Limit: 2000/1000 MS (Java/Others ...

  3. ACM : HDU 2899 Strange fuction 解题报告 -二分、三分

    Strange fuction Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) Tot ...

  4. hdu 2899 Strange fuction (二分法)

    Strange fuction Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)T ...

  5. hdoj 2899 Strange fuction【二分求解方程】

    Strange fuction Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)T ...

  6. 【精度问题】【HDU2899】Strange fuction

    Strange fuction Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) ...

  7. Strange fuction

    Strange fuction Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) Tot ...

  8. HDU2899 Strange fuction 【二分】

    Strange fuction Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) ...

  9. hdu 2899 Strange fuction (二分)

    题目链接:http://acm.hdu.edu.cn/showproblem.pihp?pid=2899 题目大意:找出满足F(x) = 6 * x^7+8*x^6+7*x^3+5*x^2-y*x ( ...

随机推荐

  1. 双系统(win10+ubuntu)卸载Ubuntu系统

    之前装的双系统,Win10 和Ubuntu ,系统引导使用的是Ubuntu的Grup的引导, 直接删除Ubuntu会导致引导丢失,会很麻烦,win10直接会挂掉,后期恢复需要重建引导 安全删除思路,先 ...

  2. centos 6.5 升级openssh-7.5

    1.环境 2.安装telnet 服务,防止ssh升级之后登陆不上服务器,使用telnet 连接服务器 yum install telnet-server -y chkconfig telnet on ...

  3. LeetCode——142 设计链表2

    题目 代码 class Solution { public: ListNode *detectCycle(ListNode *head) { ListNode *fast = head, *slow ...

  4. hackinglab 基础关 writeup

    地址:http://hackinglab.cn/ 基础关 key在哪里? 很简单,点击过关地址,在新打开的网页中查看网页源代码就能在 HTML 注释中发现 key 再加密一次你就得到key啦~ 明文加 ...

  5. Vue 基础 day04

    什么是路由 后端路由: 对于普通的网站,所有的超链接都是URL地址,所有的URL地址都对应服务器的资源: 前端路由: 对于单页面应用程序来说,主要是通过URL中的hash(#)来实现不同页面之间的跳转 ...

  6. [BNDSOJ] 小P的数列代码

    感谢gjznb大佬的帮助Orz #include<bits/stdc++.h> using namespace std; ; vector<int> dp[N][N]; ]; ...

  7. WOJ#3882 旅行问题(POI2004)

    描述 John打算驾驶一辆汽车周游一个环形公路.公路上总共有n车站,每站都有若干升汽油(有的站可能油量为零),每升油可以让汽车行驶一千米.John必须从某个车站出发,一直按顺时针(或逆时针)方向走遍所 ...

  8. 浏览器输入url按回车背后经历了哪些?

    在PC浏览器的地址栏输入一串URL,然后按Enter键这个页面渲染出来,这个过程中都发生了什么事? 1.首先,在浏览器地址栏中输入url,先解析url,检测url地址是否合法2.浏览器先查看浏览器缓存 ...

  9. Git 出现Branch master set up to track remote branch master问题 与忽略文件上传

    错误:在push 到远程仓库是一直提示下列错误,检查了使用status检查了也没有发现错误,最后排查出来是当前分支为((no branch))即右上那个id (┬_┬)..... 原因:出现这个问题的 ...

  10. glibc2.22