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 ( ...
随机推荐
- [转]服务器自动化操作 RunDeck
From : http://www.oschina.net/p/rundeck/similar_projects?sort=view&lang=25 RunDeck 是用 Java/Grail ...
- EBS中使用java进行 JavaConcurrentProgram 请求获取参数
public class MainTest implements JavaConcurrentProgram { //实现interface中的runProgram方法 public void run ...
- echo "scale=100; a(1)*4" | bc -l 输出圆周率
突然看到echo "scale=100; a(1)*4" | bc -l可以输出圆周率,很惊奇,后来发现很简单. 首先bc是“basic calculator”的缩写,就是初级的计 ...
- python 控制 cmd 命令行颜色
基于win7 + python3.4 import ctypes import sys '''Windows CMD命令行颜色''' # 句柄号 STD_INPUT_HANDLE = -10 STD_ ...
- ViewConfiguration.getScaledTouchSlop () 用法
getScaledTouchSlop是一个距离,表示滑动的时候,手的移动要大于这个距离才开始移动控件.如果小于这个距离就不触发移动控件,如viewpager就是用这个距离来判断用户是否翻页 ViewC ...
- windows live writer 尝试登陆时发生意外错误,导致无法发表博客解决方案
刚用windows live writer发表博客, 但是出现如下提示: 尝试登陆时发生意外错误: 网络连接错误--尝试连接到一下日志时出错: http://www.cnblogs.com//xxxx ...
- 创建Maven工程
一.Maven工程创建 File->New->Other,进入: 点击Next,进入: 勾选上Create a simple project(不使用骨架) 点击Next,进入: 输入项目名 ...
- UIView的layoutSubviews和drawRect方法何时调用 ———转
转自:http://jianyu996.blog.163.com/blog/static/112114555201305113018814/ 首先两个方法都是异步执行.layoutSubviews方便 ...
- Flask 开发全球化应用
从C#世界迈入python总是令人有一种如释重负之感,同样的效果同样的功能,只需要付出1/10不到的代价,可能正是Python所倡导的简美哲学所带来的威力. 我还深深地记得在ASP.NET中做全球化的 ...
- [C#]MemoryStream.Dispose之后,为什么仍可以ToArray()?
目录 概述 MemoryStream分析 总结 概述 事件起因,一哥们在群里面贴出了类似下面这样的一段代码: class Program { static void Main(string[] arg ...