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. java RMI 远程调用

    1.背景 在学习代理模式的过程中接触到了远程调用,jdk有自己的RMI实现,所以这边自己实现了RMI远程调用,并记录下心得. 感受最深的是RMI和现在的微服务有点相似,都是通过"注册中心&q ...

  2. python接口自动化:对外接口sign签名

    签名参数sign生成的方法: 在接口开发过程中,一般通过时间戳+sign作为密匙加密传输 实现代码如下: #python实现sign签名 import hashlib,time class sign: ...

  3. Python笔记(二十七)_魔法方法_容器

    定制容器 容器类型的协议: 定制不可变容器,只需要定义__len__()和__getitem__()方法 定制可变容器,需要定义__len__().__getitem__().__setitem__( ...

  4. 如何搭建Vue环境?

    搭建vue的开发环境: https://cn.vuejs.org/v2/guide/installation.html 1.     必须要安装nodejs cnpm  下载包的速度更快一些. 地址: ...

  5. Java之九九乘法表

    public class MultiplicationTable { public static void main(String[] args) { for(int i=1;i<=9;i++) ...

  6. 《剑指offer》面试题14 调整数组顺序使奇数位于偶数前面 Java版

    (输入整数数组,使所有奇数位于前半部分,所有偶数位于后半部分.) 我的方法:想到用两个下标分别表示奇数和偶数的界线,一个在开头,一个在末尾,判断每一个数字的类别,然后将它放入对应的范围内,移动下标,直 ...

  7. Codeforces - 1198D - Rectangle Painting 1 - dp

    https://codeforces.com/contest/1198/problem/D 原来是dp的思路,而且是每次切成两半向下递归.好像在哪里见过类似的,貌似是紫书的样子. 再想想好像就很显然的 ...

  8. Codeforces - 1199D - Welfare State - 单调栈 / 线段树

    https://codeforc.es/contest/1199/problem/D 其实后来想了一下貌似是个线段树的傻逼题. 单调栈是这样思考的,每次单点修改打上一个最终修改的时间戳.每次全体修改就 ...

  9. ASP.NET @URL帮助类

    原文: https://www.cnblogs.com/bobo-show/p/5746389.html    https://www.cnblogs.com/zhuji/p/7698057.html ...

  10. 把int 类型转化为varchar并且去掉小数点同时以千分号‘,’分割

    把int 类型转化为money 类型,再转化为varchar,去掉小数点同时以千分号‘,’分割. select '$' + left(Convert(VARCHAR, cast(10000 as mo ...