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 100;
Now please try your lucky.
#include<iostream>
#include<math.h>
#include<stdio.h>
using namespace std;
double deal(double x)
{
return 8*pow(x,4)+7*pow(x,3)+2*pow(x,2)+3*x+6;
}
int main()
{
int t;
scanf("%d",&t);
while(t--)
{
double x,sum,l=0,r=100;
scanf("%lf",&sum);
if(sum<deal(0)||sum>deal(100.0))
{
printf("No solution!\n");
continue;
}
else
{
double mid;
int flg=0;
while(r-l>1e-6)
{
mid=(l+r)/2;
if(deal(mid)>sum)
r=mid;
else
l=mid;
}
printf("%.4lf\n",r);
}
}
return 0;
}

hdu2199(高精度二分模版)的更多相关文章

  1. POJ 2109 Power of Cryptography【高精度+二分 Or double水过~~】

    题目链接: http://poj.org/problem?id=2109 参考: http://blog.csdn.net/code_pang/article/details/8263971 题意: ...

  2. poj 1064 高精度 二分

    Cable master Time Limit: 1000MS Memory Limit: 10000K Total Submissions: 32191 Accepted: 6888 Descrip ...

  3. poj2018(高精度二分+dp)

    题意:给你n个数,要你在这n个数里面找到一些连续的数,这些数的数量大于等于m,并且他们的平均值在这n个数里面是最大的....... 思路:先把n个数的最大最小值确定,然后二分枚举平均值,对于每一个连续 ...

  4. Can you solve this equation?---hdu2199(二分)

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

  5. CodeForce-782B The Meeting Place Cannot Be Changed(高精度二分)

    https://vjudge.net/problem/CodeForces-782B B. The Meeting Place Cannot Be Changed time limit per tes ...

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

  7. [HNOI2004]高精度开根

    题目:洛谷P2293.BZOJ1213. 题目大意:给你$n,k(n\leq 10^{10000},k\leq 50)$,求$\lfloor \sqrt[k]{n}\rfloor$. 解题思路:高精度 ...

  8. NOIP初赛:完善程序做题技巧

    最近写的文章好像还很多的.那么今天我们来讨论NOIP初赛的题型--完善程序.完善程序相对是比较难的题目了.全卷100分,完善程序占了大概26分,占比非常大.如果和英语考试试卷做比较,相当于首字母填空( ...

  9. [POJ2109]Power of Cryptography

    [POJ2109]Power of Cryptography 试题描述 Current work in cryptography involves (among other things) large ...

随机推荐

  1. c#实现统计代码运行时间

    方法一: //实例化一个计时器 Stopwatch watch = new Stopwatch(); //開始计时 watch.Start(); //此处为要计算的执行代码 for (int i = ...

  2. 整理两个JVM博客集合,空闲时候可以看

    纯洁的微笑写的:https://www.cnblogs.com/ityouknow/p/5614961.html 集合:http://www.cnblogs.com/ityouknow/categor ...

  3. linux脚本加密shc

    linxu的shell脚本看下源码,都能明白含义.加密也是很关键的 01.安装shc加密 http://www.datsi.fi.upm.es/~frosal/sources/   ###下载源码 百 ...

  4. 转:基于 linux 平台的 libpcap 源代码分析

    libpcap 是 unix/linux 平台下的网络数据包捕获函数包,大多数网络监控软件都以它为基础.Libpcap 可以在绝大多数类 unix 平台下工作,本文分析了 libpcap 在 linu ...

  5. ocat

    <!DOCTYPE html> <html lang="zh-CN" > <head><meta http-equiv="Con ...

  6. 【LeetCode】【Python题解】Reverse Integer

    Reverse digits of an integer. Example1: x = 123, return 321 Example2: x = -123, return -321 click to ...

  7. jquery json ajax三级联动

    province_city_area.jsp <%@ page language="java" pageEncoding="UTF-8"%> < ...

  8. 面试题 Comparable、Comparator 比较

    Comparable 用作默认的比较方式 Comparator 用作自定义的比较方式,当默认的比较方式不适用时或者没有提供默认的比较方式,使用Comparator就非常有用. 像Arrays和Coll ...

  9. 消息队列实现回射客户/服务器和 msgsnd、msgrcv 函数

    一.msgsnd 和 msgrcv 函数 #include <sys/types.h>   #include <sys/ipc.h>   #include <sys/ms ...

  10. 基于KWIC 的keyword匹配算法(管道+过滤器模式下实现)

    以下是基于KWIC 的keyword匹配算法(管道+过滤器模式下实现) 关键部分的管道+过滤器 软件体系下的实现, 在非常多的keyword搜索平台都使用了这一 循环移位+排序输出的 keyword匹 ...