hdu2899 Strange fuction
在区间(0,100)。在恒大二阶导数0。f(x)有极小值。用的最低要求的一阶导数值点;
#include<math.h>
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
const double eps=1e-6;
double f(double x,double y)
{
return 6*pow(x,7)+8*pow(x,6)+7*pow(x,3)+5*pow(x,2)-y*x;
}
double fpi(double x,double y)
{
return 42*pow(x,6)+48*pow(x,5)+21*pow(x,2)+10*x-y;
}
double slove(double y)
{
double left=0.0,right=100.0,mid;
while(right-left>eps)
{
mid=(left+right)/2;
if(fpi(mid,y)<0.0)
left=mid;
else
right=mid;
}
return mid;
}
int main(void)
{
int t;
double y;
scanf("%d",&t);
while(t--)
{
scanf("%lf",&y);
printf("%.4f\n",f(slove(y),y));
}
return 0;
}
版权声明:本文博客原创文章。博客,未经同意,不得转载。
hdu2899 Strange fuction的更多相关文章
- 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 ...
- 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 ...
随机推荐
- 使用shell命令分析统计日志
用户需要登录统计信息,当分析用户行为,使用shell通常可以很容易地取出了大量的数据.删除,然后放入excel统计. 例如:统计日志含有loadCustomProcess这个地址的訪问,按訪问耗时排序 ...
- SpringMVC 学习笔记(两) @RequestMapping、@PathVariable和其他注意事项
1.1. @RequestMapping映射请求 SpringMVC 采用 @RequestMapping 注解为控制器指定能够处理那些URL 请求 @requestMapping 能够定义在 类 ...
- codeforces 236A . Boy or Girl(串水问题)
A. Boy or Girl 点击打开题目 time limit per test 1 second memory limit per test 256 megabytes input standar ...
- hdu 4965 Fast Matrix Calculation(矩阵高速幂)
题目链接.hdu 4965 Fast Matrix Calculation 题目大意:给定两个矩阵A,B,分别为N*K和K*N. 矩阵C = A*B 矩阵M=CN∗N 将矩阵M中的全部元素取模6,得到 ...
- Benchmark与Profiler---性能调优得力助手
转载请注明出处:http://blog.csdn.net/gaoyanjie55/article/details/34981077 性能优化.它是一种诊断性能瓶颈,能问题点进行优化的过程.前两天听完s ...
- ServletRequest接口召回总结
<body> <form action="LoginServlet" method="post"> User:<input typ ...
- poj 1185 火炮 (减少国家DP)
火炮 Time Limit: 2000MS Memory Limit: 65536K Total Submissions: 19690 Accepted: 7602 Description 司 ...
- WebHooks
WebHooks ASP.NET 5 Beta 7 版本 在 VS2015 发布的同时,微软也发布了 ASP.NET 5 的路线图(详见ASP.NET 5 Schedule and Roadmap ...
- Oracle实践--PL/SQL表分区的基础
PL/SQL基础入门之表分区 PL/SQL:过程语言(Procedure Language)和结构化语言(Structured Query Language)结合而成的编程语言.是对SQL的扩展.支 ...
- zoj2588 Burning Bridges --- 寻求尖端
#include <iostream> #include <cstring> #include <string> #include <cstdio> # ...