hdu 2199 (二分)
链接:http://acm.hdu.edu.cn/showproblem.php?pid=2199
Can you solve this equation?
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)
Total Submission(s): 8595 Accepted Submission(s): 3957
Now please try your lucky.
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <iostream>
#include <algorithm>
#include <math.h>
#define eps 1e-8
using namespace std; double fx(double x)
{
return *pow(x,)+*pow(x,)+*x*x+*x+;
} int main()
{
int n,m,i,j;
double y;
double left=,right=,ans;
scanf("%d",&n);
while(n--)
{
scanf("%lf",&y);
left=0.0,right=100.0;
//ans=-100000;
bool flag=true;
while(right-left>eps)
{
double mid=(left+right)/2.0;
if(fx(mid)-y< )
left=mid+eps;
else right=mid-eps;
//if()flag=false;
}
if(y>fx() || y<fx())
printf("No solution!\n");
else
printf("%.4lf\n",left);
} }
hdu 2199 (二分)的更多相关文章
- HDU 2199 二分
我们可以发现这个函数是单增的,那么这样二分就好了. 反思:刚转C++,不会用scanf读入实数.(scanf("%lf",&y)) //By BLADEVIL #inclu ...
- 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 4024 二分
转自:http://www.cnblogs.com/kuangbin/archive/2012/08/23/2653003.html 一种是直接根据公式计算的,另外一种是二分算出来的.两种方法速度 ...
- 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 ...
- 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 ( ...
随机推荐
- javaWeb 使用jsp开发 html过滤标签
1.jsp调用代码 <t:htmlFilter> <a href="${pageContext.request.contextPath }/index.jsp"& ...
- BlueDroid介绍 【转】
转自:http://blog.csdn.net/fen_liu/article/details/41213167 [-] 基本结构 代码区 http://www.cnblogs.com/hzl6255 ...
- Java中的线程同步机制
一.首先为什么线程需要同步? 1.多线程安全问题的原因 A:有多线程环境 B:有共享数据 C:有多条语句操作共享数据 2. //未完待续后面会继续更新
- Dynamics AX 2012 R2 Business Connector Error
6.0: AxCryptoClient - New encryption key created 6.0: Unable to InitializeSession. 6.0: No built-in ...
- DOM元素尺寸和位置
一.获取元素 CSS大小 1.通过style 内联获取元素的大小 var box = document.getElementById('box'); //获取元素 box.style.width; / ...
- a different object with the same identifier,同一个session中存在不同的对象问题
使用hibernate的函数 session.merge()函数,提交处于游离态的对象. merge在执行更新之前会将两个标识符相同的对象进行合并,具体合并的方向是向exituser2合并.
- textarea不能提交html格式的代码
解决方法:web.config中<system.web>节点添加 <httpRuntime targetFramework="4.5" requestValida ...
- PHP获取手机相关信息
该PHP操作类实现获取手机号手机头信息,取UA,取得手机类型,判断是否是opera,判断是否是m3gate,取得HA,取得手机IP 代码如下: <?php /** * @desc 手机操作类 获 ...
- 20150625_Andriod_01_ListView1_条目选中
android listview 参考地址: http://www.cnblogs.com/zhengbeibei/archive/2013/05/14/3078805.html http://xy ...
- Communication System(dp)
Communication System Time Limit: 1000MS Memory Limit: 10000K Total Submissions: 25006 Accepted: 8925 ...