Strange fuction

Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)
Total Submission(s): 2098    Accepted Submission(s): 1577

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
 
Recommend
lcy
代码:
 #include<iostream>
#include<cmath>
#include<cstdio>
using namespace std;
double y;
double sum(double x)
{
return *pow(x,)+*pow(x,)+*pow(x,)+*pow(x,)-y*x;
}
double func(double x)
{
return *pow(x,)+*pow(x,)+*x*x+*x-y;
}
int main()
{
int t;
double mid,left,right;
cin>>t;
while(t--)
{
scanf("%lf",&y);
if(func()>)
{
left=0.0,right=100.0;
while(right-left>1e-)
{
mid=(right+left)/2.0;
if(func(mid)>0.0)
right=mid;
else
if(func(mid)<0.0)
left=mid;
else
break;
}
printf("%.4lf\n",sum(mid));
}
else
printf("%.4lf\n",sum(100.0));
}
return ;
}

HDUOJ--Strange fuction的更多相关文章

  1. ACM : HDU 2899 Strange fuction 解题报告 -二分、三分

    Strange fuction Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) Tot ...

  2. hdu 2899 Strange fuction

    http://acm.hdu.edu.cn/showproblem.php?pid=2899 Strange fuction Time Limit: 2000/1000 MS (Java/Others ...

  3. hdoj 2899 Strange fuction【二分求解方程】

    Strange fuction Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)T ...

  4. 【精度问题】【HDU2899】Strange fuction

    Strange fuction Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) ...

  5. Strange fuction

    Strange fuction Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) Tot ...

  6. hdu 2899 Strange fuction (二分法)

    Strange fuction Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)T ...

  7. HDU2899 Strange fuction 【二分】

    Strange fuction Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) ...

  8. Strange fuction hdu 2899

    Strange fuction Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)T ...

  9. 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 ...

  10. Hdoj 2899.Strange fuction 题解

    Problem Description Now, here is a fuction: F(x) = 6 * x^7+8x^6+7x^3+5x^2-yx (0 <= x <=100) Ca ...

随机推荐

  1. Android之在应用程序内部关注某人的微信

    Intent intent = new Intent(Intent.ACTION_VIEW); intent.setPackage("com.tencent.mm");//直接打开 ...

  2. 谷歌死忠速查:可访问谷歌google搜索的IP们

    [见谅! 此文已废了,下面的办法已经无效了!]但是访问我博客并回复的哥们“问天何必”提供了一个方法,详见http://www.gaomn.com/,他提供了一个网站来访问google的,速度还算可以, ...

  3. 混沌数学之Henon吸引子

    Henon吸引子是混沌与分形的著名例子. 相关软件:混沌数学及其软件模拟相关代码: // http://wenku.baidu.com/view/d51372a60029bd64783e2cc0.ht ...

  4. EF操作增删改查

    lianxiEntities db = new lianxiEntities();//上下文的入口 #region //EF Added //UserInfo user = new UserInfo( ...

  5. go的基结构体如何使用派生结构体的方法

    将派生类的方法声明为接口嵌入到基结构体中,派生结构体声明该接口为自身.

  6. iOS开发-委托实战

    昨天晚上头疼,写了一部分草草的收笔了,早上起来补发一篇文章,昨天关于委托的基本使用和概念都稍微讲了一下,最开始学习委托的时候苹果官网和中文的博客文章看了不少,相似指数比较高.委托在命名要准确,最好是一 ...

  7. 【系统】supervisor支持多进程

    [program:deployworker] directory = /etc/ansible/easyAnsible/app/deploy/ command = python Deploy.py p ...

  8. WebRequest多线程 超时问题

    using System; using System.Collections; using System.Collections.Generic; using System.Net; using Sy ...

  9. [Javascript] Prototype 2 Object.create()

    function Fencepost (x, y, postNum){ this.x = x; this.y = y; this.postNum = postNum; this.connections ...

  10. 更改Apache的首页

    本机Apache的安装过程请见: Apache的首页是由/usr/local/httpd/conf/httpd.conf文件的DocumentRoot决定的. ...## DocumentRoot: ...