hdu 2199 Can you solve this equation? (二分法)
Can you solve this equation?
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)
Total Submission(s): 5999 Accepted Submission(s): 2828
Now please try your lucky.
100
-4
No solution!
//15MS 248K 537 B C++
/* 题意:
给出一条公式:
8*x^4 + 7*x^3 + 2*x^2 + 3*x + 6 == Y
和Y的值,要求你在(0,100)的范围内求4位小数精确解 二分法:
先排除无解的情况,因为函数在(0,100)单调递增,最小值为6,
最大值为fac(100),先排除无解情况然后用二分法计算 */
#include<stdio.h>
#define e 1e-7
double fac(double a)
{
return (*a*a*a*a+*a*a*a+*a*a+*a+);
}
int main(void)
{
int t;
double n;
scanf("%d",&t);
while(t--)
{
scanf("%lf",&n);
if(n< || n>fac()){
puts("No solution!");continue;
}
double l=;
double r=;
while(r-l>e){
double mid=(l+r)/;
if(fac(mid)>n) r=mid;
else l=mid;
}
printf("%.4lf\n",r);
}
return ;
}
color: #800080;
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 ...
- hdu 2199:Can you solve this equation?(二分搜索)
Can you solve this equation? Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K ( ...
- 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 ( ...
随机推荐
- memcached搭建
MemCache 安装使用 安装memcached之前首先需要安装libevent, 如果没有安装的请自行去安装. 下载memcache http://www.memcached.org/files/ ...
- Java学习笔记十二:Java中方法的重载
Java中方法的重载 什么是方法的重载呢? 如果同一个类中包含了两个或两个以上方法名相同.方法参数的个数.顺序或类型不同的方法,则称为方法的重载,也可称该方法被重载了.如下所示 4 个方法名称都为 s ...
- narcissus
public class narcissus { public static void main(String args[]) { long u=0,t=0,h=0,y=0,k=0; for(long ...
- vue---day01
1.let和const var 全局作用域和函数作用域 存在变量提升 其实是个bug 可以重复声明 let 块级作用域 不存在变量提升 不能重复声明 const 常量 和let一样还有另外两个 定义的 ...
- [Cracking the Coding Interview] 4.6 Successor 后继节点
Write an algorithm to find the 'next' node(i.e. in-order successor) of a given node in a binary sear ...
- ubuntu下安装LAMP环境遇到的一些小问题
0x00 今天在服务器上重新弄了一下lamp环境 安装的过程中遇到了不少小问题 记录一下解决的方案吧 服务器安装的是ubuntu 16.04.1 0x01 首先在用 apt-get install 安 ...
- 在WPF中自定义控件(1)
原文:在WPF中自定义控件(1) 在WPF中自定义控件(1):概述 周银辉一, 不一定需要自定 ...
- 高德API+.NET解决租房问题(新增诚信房源)
作者:李国宝链接:https://zhuanlan.zhihu.com/p/22105008(欢迎点赞)来源:知乎著作权归作者所有.商业转载请联系作者获得授权,非商业转载请注明出处. 之前有小伙伴反应 ...
- anaconda虚拟环境操作
1.首先在所在系统中安装Anaconda.可以打开命令行输入conda -V检验是否安装以及当前conda的版本. 2.conda常用的命令. 1)conda list 查看安装了哪些包. 2)con ...
- RTSC和XDCTool的理解
1. 在使用TI的开发工具CCS中,里面有几个重要的概念,一直不太清晰,RTSC是什么,XDCTool是什么?包是什么?包的版本为啥都是4位的(比如mathlib_c66x_3_0_1_1)?star ...