hdu 2199 Can you solve this equation?


#include<stdio.h>
#include<math.h>
double f(double x)
{
return 8*x*x*x*x+7*x*x*x+2*x*x+3*x+6;
}
int main(void)
{
int t;
double y,x1,x2,x3,y1,y2,y3;
scanf("%d",&t);
while(t--)
{
scanf("%lf",&y);
x1=0;
x2=100;
y1=f(x1)-y;
y2=f(x2)-y;
if(y1>0||y2<0)
{
printf("No solution!\n");
}
else
{
while(fabs(y1-y2)>=0.0001)
{
x3=(x1+x2)/2;
y3=f(x3)-y;
if(y3>=0)
{
x2=x3;
}
else
{
x1=x3;
}
y1=f(x1)-y;
y2=f(x2)-y;
}
printf("%0.4f\n",x3);
}
}
return 0;
}
hdu 2199 Can you solve this equation?的更多相关文章
- HDU 2199 Can you solve this equation?(二分精度)
HDU 2199 Can you solve this equation? Now,given the equation 8*x^4 + 7*x^3 + 2*x^2 + 3*x + 6 == ...
- hdu 2199 Can you solve this equation?(高精度二分)
http://acm.hdu.edu.cn/howproblem.php?pid=2199 Can you solve this equation? Time Limit: 2000/1000 MS ...
- HDU 2199 Can you solve this equation?(二分解方程)
传送门: http://acm.hdu.edu.cn/showproblem.php?pid=2199 Can you solve this equation? Time Limit: 2000/10 ...
- ACM:HDU 2199 Can you solve this equation? 解题报告 -二分、三分
Can you solve this equation? Time Limit: / MS (Java/Others) Memory Limit: / K (Java/Others) Total Su ...
- hdu 2199 Can you solve this equation?(二分搜索)
Can you solve this equation? Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K ( ...
- hdu 2199:Can you solve this equation?(二分搜索)
Can you solve this equation? Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K ( ...
- HDU 2199 Can you solve this equation? (二分 水题)
Can you solve this equation? Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K ( ...
- HDU 2199 Can you solve this equation(二分答案)
Can you solve this equation? Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K ( ...
- HDU - 2199 Can you solve this equation? 二分 简单题
Can you solve this equation? Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K ( ...
- hdu 2199 Can you solve this equation? 二分
Can you solve this equation? Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K ( ...
随机推荐
- R 语言实现牛顿下降法
凸是一个很好的性质.如果已经证明了某个问题是凸的,那这个问题基本上算是解决了. 最近在解决一个多目标优化的问题.多目标的问题往往是非凸的.好在能够知道这个问题的近似解大概是多少.这样这个多目标优化的问 ...
- 点击劫持(CLICKJACKING)与X-FRAME-OPTIONS HEADER
转载: http://www.tuicool.com/articles/mqUBfa 目录 前言 1.1 点击劫持(clickjacking attacks) 1.2 Frame Bursters. ...
- PPPOE原理及部署
PPPOE 1,一个广播域 2,panabit可以做小区项目 http://edu.51cto.com/course/course_id-3849.html Adsl的介绍 所谓非对称,即上下行速 ...
- .NET性能调优之一:ANTS Performance Profiler的使用
.NET性能调优系列文章 系列文章索引 .NET性能调优之一:ANTS Performance Profiler的使用 .NET性能调优之二:使用Visual Studio进行代码度量 .NET性能调 ...
- MVC4 WebAPI
不管是因为什么原因,结果是在新出的MVC中,增加了WebAPI,用于提供REST风格的WebService,个人比较喜欢REST风格的WebService,感觉比SOAP要轻量级一些,而且对客户端的要 ...
- PagerIndicator主题样式修改
默认的黑色好丑 所以大家需要动手改造一下, 1 打开 Manifest.xml <activity android:name="com.zb.zhihuianyang.MainActi ...
- IOS开发之—— iOS 支付 [支付宝、银联、微信]
支付宝iOSsdk官方下载sdk地址:https://b.alipay.com/order/productDetail.htm?productId=2013080604609654&tabId ...
- 细说C#多线程那些事 - 线程同步和多线程优先级
上个文章分享了一些多线程的一些基础的知识,今天我们继续学习. 一.Task类 上次我们说了线程池,线程池的QueueUserWorkItem()方法发起一次异步的线程执行很简单 但是该方法最大的问题是 ...
- IT男的”幸福”生活"续3
我和MM一进饭店,服务员走过,面带笑容,说:“欢迎,欢迎,两位里面坐.” ...... 谢谢大家的捧场,IT的”幸福”生活.是我的回忆录来着.真实可靠,在写法上有点小说化.可能是我一直看小说的原因吧, ...
- Pro Git 读书笔记
一. 起步 1. 集中式版本控制缺点:中央服务器的单点故障. 分布式版本控制优点:客户端并不只提取最新版本的文件快照,而是把代码仓库完整地镜像下来. 这么一来,任何一处协同工作用的服务器发生故障,事后 ...