http://acm.hdu.edu.cn/showproblem.php?pid=2199

给出y的值求x;

8*x^4 + 7*x^3 + 2*x^2 + 3*x + 6 = Y

x是0到100的实数所以要用二分的方法;

#include <iostream>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <algorithm>
#include <queue>
using namespace std;
#define N 110
#define INF 0xffffff int main()
{
int T,flag;
double y, m, L, R, Mid;
scanf("%d", &T);
while(T--)
{
scanf("%lf", &y);
m=*pow(,)+*pow(,)+*pow(,)+*+;
if(m<y||y<)
{
printf("No solution!\n");
continue;
}
L=;R=;
while(L<=R)
{
Mid=(L+R)/;
m=*pow(Mid,)+*pow(Mid,)+*pow(Mid,)+*Mid+;
if(fabs(m-y)<0.0001)
{
flag=;
break;
}
else if(m>y)
{
R=Mid;
}
else
{
L=Mid;
}
}
if(flag==)
printf("%.4lf\n", Mid);
else
printf("No solution!\n");
}
return ;
}

Can you solve this equation?---hdu2199(二分)的更多相关文章

  1. HDU 2199 Can you solve this equation(二分答案)

    Can you solve this equation? Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K ( ...

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

  3. Can you solve this equation?(二分)

    Can you solve this equation? Time Limit : 2000/1000ms (Java/Other)   Memory Limit : 32768/32768K (Ja ...

  4. HDU 2199 Can you solve this equation?【二分查找】

    解题思路:给出一个方程 8*x^4 + 7*x^3 + 2*x^2 + 3*x + 6 == Y,求方程的解. 首先判断方程是否有解,因为该函数在实数范围内是连续的,所以只需使y的值满足f(0)< ...

  5. Day3-K-Can you solve this equation? HDU2199

    Now,given the equation 8*x^4 + 7*x^3 + 2*x^2 + 3*x + 6 == Y,can you find its solution between 0 and ...

  6. hdoj 2199 Can you solve this equation? 【二分枚举】

    题意:给出一个数让你求出等于这个数的x 策略:如题. 由于整个式子是单调递增的.所以能够用二分. 要注意到精度. 代码: #include <stdio.h> #include <s ...

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

  8. HDU 2199 Can you solve this equation? (二分 水题)

    Can you solve this equation? Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K ( ...

  9. HDU - 2199 Can you solve this equation? 二分 简单题

    Can you solve this equation? Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K ( ...

随机推荐

  1. QHeaderView的点击和双击事件

    QTablewidget的horizontalHeader() 和 verticalHeader() 得到的表头:QHeaderView 点击事件的触发函数: sectionClicked(int) ...

  2. Maven-使用及常见问题

    一.Maven是什么? 管理jar包用的,以前jar包是自己下载,然后放在lib下,然后add build Path,Maven环境下,只需要添加坐标(实际是xml片段)便会根据坐标自行下载. 二.M ...

  3. C++ string(转)

    C++中string是标准库中一种容器,相当于保存元素类型为char的vector容器(自己理解),这个类提供了相当丰富的函数来完成对字符串操作,以及与C风格字符串之间转换,下面是对string一些总 ...

  4. ulimit设置句柄数

    这几天在做一个性能测试,写了一个模拟发送http的程序.模拟100并发的情况下,随机发http get的请求.放到服务器上运行一段时间抛出Too many open files的异常. 这几天在做一个 ...

  5. hadoop3.1.0 window win7 基础环境搭建

    https://blog.csdn.net/wsh596823919/article/details/80774805 hadoop3.1.0 window win7 基础环境搭建 前言:在windo ...

  6. 编辑框添加灰色提示字(html+VC)

    Html中添加灰色提示字,使用属性placeholder即可! <input type="text" placeholder="要显示的文字"> 但 ...

  7. 拼凑sql语句另外一个方法

    经常拼凑sql语句,经常是手工拼写 也可以利用字典另外一个模式拼凑 这里采用的是Dictionary中的Aggregate方法. 代码如下: static void Main(string[] arg ...

  8. 笔记:写Java程序,并输出

    建一个文件名为 demo.java的文件 //写框架文件 public class Demo{ //写入口文件 public static void main(String[] args){ Syst ...

  9. downtown uptown

    Downtown is a term primarily used in North America by English speakers to refer to a city's core (or ...

  10. css图片宽高相等设置

    <div class="image-header"> <img src="demo.jpg"> </div> .image- ...