Strange fuction hdu 2899
Strange fuction
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)
Total Submission(s): 4803 Accepted Submission(s): 3428
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.
100
200
-178.8534
#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的更多相关文章
- (二分搜索 )Strange fuction -- HDU -- 2899
链接: http://acm.hdu.edu.cn/showproblem.php?pid=2899 Time Limit: 2000/1000 MS (Java/Others) Memory ...
- hdu 2899 Strange fuction
http://acm.hdu.edu.cn/showproblem.php?pid=2899 Strange fuction Time Limit: 2000/1000 MS (Java/Others ...
- ACM : HDU 2899 Strange fuction 解题报告 -二分、三分
Strange fuction Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) Tot ...
- hdu 2899 Strange fuction (二分法)
Strange fuction Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)T ...
- hdoj 2899 Strange fuction【二分求解方程】
Strange fuction Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)T ...
- 【精度问题】【HDU2899】Strange fuction
Strange fuction Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) ...
- Strange fuction
Strange fuction Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) Tot ...
- HDU2899 Strange fuction 【二分】
Strange fuction Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) ...
- 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 ( ...
随机推荐
- hadoop 与 hbase 添加开机启动,按顺序,先hadoop,后hbase,开机启动脚本,hbase学习
hadoop安装,hbase单机安装,参考链接,https://blog.csdn.net/LiuHuan_study/article/details/84347262 开机启动脚本,参考, http ...
- redis 设置密码 和 redis.config文件
- Policy Improvement and Policy Iteration
From the last post, we know how to evaluate a policy. But that's not enough, because the purpose of ...
- Acwing.835. Trie字符串统计(模板)
维护一个字符串集合,支持两种操作: “I x”向集合中插入一个字符串x: “Q x”询问一个字符串在集合中出现了多少次. 共有N个操作,输入的字符串总长度不超过 105105,字符串仅包含小写英文字母 ...
- 利用vsftpd在Linux构建安全的FTP服务
最近在机房搭建Linux环境,需要用到了FTP服务,查看了许多的资料,在这里做一下笔记 一.安装 方法一,使用yum命令安装,需要能够连接外网 # yum install vsftpd 方法二,使用安 ...
- Antd-react-mobile项目学习中遇到的问题记录(持续更新)
1.Error:The "injectBabelPlugin" helper has been deprecated as of v2.0. You can use customi ...
- Nodejs的模块化
Node.js中的模块化 好处: 复用性高,一次定义,多次使用 前端模块化 AMD AMD的实现需要使用 require.js CMD CMD的实现需要使用 sea.js [ 不更新 ] Common ...
- 1. AtomicInteger 、Unsafe 及 CAS方法的整理
本文摘自: https://blog.csdn.net/fanrenxiang/article/details/80623884 http://ifeve.com/sun-misc-unsafe/ h ...
- Python在windows下编译成exe文件
1. pip install pyinstaller 2. 在Terminal下输入:“pyinstaller -F -w *.py” 就可以生成exe.生成的文件放在同目录dist下. -F(注意 ...
- 阿里P7前端需要哪些技能
原谅我copy过来的,但是这个条理很清楚很有借鉴意义 前言 以下是从公众号的文章中获取到的一位阿里的前端架构师整理的前端架构p7的技能图谱,当然不是最完整.最系统的,所以之后我会一直维护更新这里的内容 ...