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. SVN目录权限配置

    1.如果要使用SVN,需要有一个项目的保存目录,例如把该目录设为“C:\MyPro”文件夹 2.把该目录发布为SVN项目目录,则需要通过以下命令行 svnadmin create c:\mypro  ...

  2. 【ExtJs】 ExtJs4.2 基本表单组件的使用

    包含ExtJs 基本的组件radioGroup,ComboBox,File,NumberField... <%-- Created by IntelliJ IDEA. User: Adminis ...

  3. 第四章 Spring.Net 如何管理您的类___对象的自动装配

    由于这几天都比较忙,所以对笔记暂时没有更新. Spring.NET具有自动装配的能力,也就是说,Spring.NET可以通过对象的定义自动分辨某个对象的协作对象.自动装配是针对单个对象(按:针对每个协 ...

  4. 08python之列表的常用方法

    列表list是python常用的数据类型,需要掌握以下常用方法: name_list = ['alex','tenglan','65brother'] 这个变量和之前的变量只存一个数字或字符串,这个列 ...

  5. Java之类型的转换

    1.String 类型转化为 int 类型,需要使用 Integer 类中的 parseInt() 方法或者 valueOf() 方法进行转换. int a = Integer.parseInt(st ...

  6. VR室内定位系统小结

    一.写在开始之前 不管是HTC 的Vive还是OC的CV1,都说明VR 定位设备和手柄都会成为未来VR的发展趋势. VR目前关键就是体验,全身心的投入,身临其境的感觉. 不能总玩着玩着,出戏了.这肯定 ...

  7. vs2010中使用luabind

    第一部分:在vs2010中生成luabind静态库和动态库 一.前期准备 1.安装boost 下载boost并解压到 D:\mylua\boost_1_56_0,进入 D:\mylua\boost_1 ...

  8. 【PHP】算法进阶,获取给定值的最优组合:虚拟币抵扣问题解决方案

    商城里边.虚拟币抵扣问题解决方案 虚拟币抵扣规则,按照以下规则执行: 1.如果一个订单包含多款商品,且均支持虚拟币抵扣时:   优先按照最大化使用虚拟币进行全额抵扣原则进行抵扣,若抵扣后用户虚拟币账号 ...

  9. MQTT的学习研究(十三) IBM MQTTV3 简单发布订阅实例

    使用IBM MQTTv3实现相关的发布订阅功能 MQTTv3的发布消息的实现: package com.etrip.mqttv3; import com.ibm.micro.client.mqttv3 ...

  10. LeetCode——N-Queens

    Description: The n-queens puzzle is the problem of placing n queens on an n×n chessboard such that n ...