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. IPv6 首部格式

    <图解TCP/IP> 4.8 IPv6的首部格式 IPv6为了减轻路由器的负担,省略了首部校验和字段.因此路由器不再需要计算校验和,从而提高了包的转发效率. 此外,分片处理所用的识别码成为 ...

  2. delphi开发实例:保存字体设置的方法

    http://blog.csdn.net/delphi308/article/details/9906147 delphi开发实例:保存字体设置的方法 2013-08-11 22:37 446人阅读  ...

  3. Krypton Suite of .NET WinForms Controls

    The Krypton Suite of .NET WinForms controls are now freely available for use in personal or commeric ...

  4. Hbse笔记

    1 角色    HMaster    RegionServer        Region:一张table        Hbase为了读写高效 有二级缓存,内存的缓存和磁盘的缓存        HL ...

  5. struts2 基础

    框架(frameWork):某一种应用的半成品 struts2: 表现层 处理与页面进行交互的相关功能  hibernate: 持久层 负责业务逻辑数据的持久化  spring: 业务层 负责复杂的业 ...

  6. Python笔记(二十三)_魔法方法_字符串的魔法方法

    __str__和__repr__ 如果要把一个类的实例变成字符串,就需要实现魔法方法__str__()和__repr__ >>>class A: def name(self): re ...

  7. VC调试方法大全

    VC调试方法大全 一.调试基础 调试快捷键 F5:  开始调试 Shift+F5: 停止调试 F10:   调试到下一句,这里是单步跟踪 F11:   调试到下一句,跟进函数内部 Shift+F11: ...

  8. Eigen的aligned_allocator

    今天看ORBSLAM2中的OptimizeEssentialGraph()函数时,对一句代码中的aligned_allocator不太清楚: vector<g2o::Sim3,Eigen::al ...

  9. [Python3 练习] 004 水仙花数

    题目:水仙花数 (1) 描述 水仙花数各位的数字的立方之和等于自身 如 153 为水仙花数,因为 153 = 1^3 + 5^3 + 3^3 (2) 要求 找到所有的三位数的水仙花数 (3) 程序 # ...

  10. [19/05/06-星期一] JDBC(Java DataBase Connectivity,java数据库连接)_基本知识

    一.概念 JDBC(Java Database Connectivity)为java开发者使用数据库提供了统一的编程接口,它由一组java类和接口组成.是java程序与数据库系统通信的标准API. J ...