Strange fuction--hdu2899
Strange fuction
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)
Total Submission(s): 4538 Accepted Submission(s):
3261
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.
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)
places),when x is between 0 and 100.
#include<stdio.h>
#include<math.h>
double hs(double x,double y)
{
return *pow(x,)+*pow(x,)+*pow(x,)+*x*x-y*x;//定义一个求函数值得函数
}
double ds(double x,double y)
{
return *pow(x,)+*pow(x,)+*pow(x,)+*x-y;//定义一个求导数的函数
}
int main()
{
int a;
scanf("%d",&a);
while(a--)
{
double b,x,y,z;
scanf("%lf",&b);
x=0.0;
y=100.0;
do
{
z=(x+y)/;
if(ds(z,b)>)
y=z;
else
x=z;
}while(y-x>1e-);//求出一定精度内导数为0的大约值
printf("%.4lf\n",hs(z,b));
}
return ;
}
#include<stdio.h>
#include<math.h>
double hs(double x,double y)
{
return *pow(x,)+*pow(x,)+*pow(x,)+*x*x-y*x;
}
int main()
{
int n;
scanf("%d",&n);
while(n--)
{
double l,r,mid,midmid,a;
scanf("%lf",&a);
l=0.0;
r=100.0;
do
{
mid=(l+r)/;
midmid=(mid+r)/;
if(hs(mid,a)>hs(midmid,a))
l=mid;
else
r=midmid;
}while(r-l>1e-);
printf("%.4lf\n",hs(mid,a));
}
return ;
}
Strange fuction--hdu2899的更多相关文章
- 【精度问题】【HDU2899】Strange fuction
Strange fuction Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) ...
- HDU2899 Strange fuction 【二分】
Strange fuction Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (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
http://acm.hdu.edu.cn/showproblem.php?pid=2899 Strange fuction Time Limit: 2000/1000 MS (Java/Others ...
- hdoj 2899 Strange fuction【二分求解方程】
Strange fuction Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)T ...
- 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 ...
- Strange fuction hdu 2899
Strange fuction Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)T ...
- hdu2899 Strange fuction
在区间(0,100).在恒大二阶导数0.f(x)有极小值.用的最低要求的一阶导数值点: #include<math.h> #include<stdio.h> #include& ...
- Strange fuction
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 <=1 ...
随机推荐
- setInterval()-----------js 函数总结
setInterval() 方法可按照指定的周期(以毫秒计)来调用函数或计算表达式. setInterval() 方法会不停地调用函数,直到 clearInterval() 被调用或窗口被关闭.由 s ...
- 用git提交代码步骤
1.git add XXXX2.git commit - 'xxx'3.git stash4. //git pull --rebase 4. git rebase origin/develop git ...
- NodeJS和C++的性能比较(转)
原文地址: http://www.web-tinker.com/article/20374.html 前段时间做了个实验,测试了1E9次的空循环在NodeJS和C++中的执行用时.于是我和小伙伴们瞬间 ...
- MySQL--query-cache
知识准备: 1.mysql 的query-cache是什么? mysql可以把执行完成的select 语句和这个select 语句对应的结果集缓存起来:下次再用调用相同的select 语句时就直接返 ...
- 超大文件上传到Azure Linux虚拟机最佳实践
客户在实际进行迁移的时候,往往碰到需要将本地数据中心的超大文件,比如单个200GB的文件,或者总共1TB的无数文件上传到Azure上的情况,尤其是传到Azure的Linux虚拟机的场景,这种场景包括: ...
- Oracle的几种索引
Oracle 提供了多种不同类型的索引以供使用.简单地说, Oracle 中包括如下索引: 1. B* 树索引 这些是我所说的 “ 传统 “ 索引.到目前为止,这是 Oracle 和大多数其他数据库中 ...
- 手机天猫nba项目总结
页面逻辑: 技术统计 比赛竞猜 猜你喜欢 进入页面时,获取服务器的当前时间.然后进行页面上的每秒递增.1.每隔n秒向后台发送请求,获取最新比分信息,球队图像,球员信息.然后更改页面.2.每隔n秒向后台 ...
- 基于Keil C的覆盖分析,总结出编程中可能出现的几种不可预知的BUG
基于Keil C的覆盖分析,总结出编程中可能出现的几种不可预知的BUG,供各位网友参考 1.编译时出现递归警告,我看到很多网友都采用再入属性解决,对于再入函数,Keil C不对它进行覆盖分析,采用模拟 ...
- %{TIMESTAMP_ISO8601} 匹配2016-08-29 17:40:01,191
2016-08-29 17:40:01,191 INFO com.zjzc.common.utils.HttpUtil - 请求接口: https://www.zjcap.cn/pay/interfa ...
- LeeCode(Database)-Duplicate Emails
Write a SQL query to find all duplicate emails in a table named Person. +----+---------+ | Id | Emai ...