ACM Strange fuction
F(x) = 6 * x^7+8*x^6+7*x^3+5*x^2-y*x (0 <= x <=100)
当x在0到100之间时,你能找到最小值吗?
输入
第一行包含一个整数T(1 < = T < = 100),这意味着测试用例的数量。然后T行,每一行只有一个实数Y。(0 < Y < 1e10)当x在0到100之间时,输出值为最小值(精确到小数点后4位)。
Sample Input
2
100
200
Sample Output
-74.4291
-178.8534
#include<bits/stdc++.h>
using namespace std;
double del(double mid) /*求导*/
{
double temp = *pow(mid,)+*pow(mid,)+*mid*mid+*mid; return temp;
} double cacu(double mid ,double y)
{
double ans;
ans = *pow(mid,)+*pow(mid,)+*pow(mid,)+*mid*mid-y*mid;
return ans;
}
int main()
{
int t;
double y;
while(cin>>t)
{
while(t--)
{
scanf("%lf",&y);
double left = ,right = ,mid;
while( right-left >1e-)
{
mid =(left+right) /;
if(del(mid) - y > )
right = mid;
else
left = mid;
}
printf("%.4lf\n",cacu(mid,y));
} }
return ;
}
ACM Strange fuction的更多相关文章
- 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 ...
- 【精度问题】【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 ...
- hdu 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 hdu 2899
Strange fuction Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)T ...
- (二分搜索 )Strange fuction -- HDU -- 2899
链接: http://acm.hdu.edu.cn/showproblem.php?pid=2899 Time Limit: 2000/1000 MS (Java/Others) Memory ...
随机推荐
- jupyter notebook的架构
最近项目需要改写jupyter notebook的内核,由于内功不够,英语过差,读文档真的是心痛,然后各种搜索找到了一篇不错的讲解. 转自:http://blog.just4fun.site/jupy ...
- 俄罗斯方块(2D、3D)
声明:这篇文章主要是参考几个别人的博文及源代码学习.参考文章: 1)http://blog.csdn.net/qian_f/article/details/19758671 2)http://yaca ...
- Packer piplines and workflow
packer对docker和aws AMI的支持都很好,来上个图: 配套的模版长这样: { "variables": { "name": "webim ...
- eclipse下maven插件搭建springmvc之helloworld
这几天学习了怎样使用maven,最终还是要回归web项目嘛,所以主要还是使用eclipse插件. 1 下载eclipse maven插件. 其实新版的eclipse已经集成了maven:lunar.m ...
- Javascript中的url编码与解码(详解)
摘要 本文主要针对URI编解码的相关问题做了介绍,对url编码中哪些字符需要编码.为什么需要编码做了详细的说明,并对比分析了Javascript中和编解码相关的几对函数escape / unescap ...
- [LeetCode] Poor Pigs 可怜的猪
There are 1000 buckets, one and only one of them contains poison, the rest are filled with water. Th ...
- [LeetCode] Judge Route Circle 判断路线绕圈
Initially, there is a Robot at position (0, 0). Given a sequence of its moves, judge if this robot m ...
- [LeetCode] The Maze II 迷宫之二
There is a ball in a maze with empty spaces and walls. The ball can go through empty spaces by rolli ...
- hadoop一键安装伪分布式
hadoop伪分布式和hive在openSUSE中的安装 在git上的路径为:https://github.com/huabingood/hadoop--------/tree/master 各个文件 ...
- [Luogu 2816]宋荣子搭积木
Description saruka非常喜欢搭积木,他一共有n块积木.而且saruka的积木很特殊,只能一块块的竖着摞,可以摞很多列.说过saruka的是特殊的积木了,这些积木都非常智能,第i块积木有 ...