hdu step 4.1.1Can you solve this equation?
来源:互联网 发布:华为网络基础知识 编辑:程序博客网 时间:2024/05/02 06:41
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;
给出一个四次方程,求0~100内的可行解。
首先马上想到二分查找,因为函数f(x)在0~100是单调递增
if (f(mid) >y)
r = mid;
else l = mid;
拿数据测了测然后跑了一下,time limit exceeds。
本来是用的float,因为只需要精确到小数点后四位,float足够了,竟然超时。
后来换成double就可以了,查了查,原来float类型作为函数参数时会自动提升为double类型,“浮点运算都是以双精度进行的,即使只有float的运算,也要先转换成double型再算的 ”
所以doublex型比float型要快一点。
0 0
- hdu step 4.1.1Can you solve this equation?
- (hdu step 4.1.1)Can you solve this equation?(使用二分法来求解方程组的解)
- hdu 2199 Can you solve this equation?
- hdu 2199 Can you solve this equation?
- hdu 2199 Can you solve this equation?
- HDU 2199 Can you solve this equation?
- HDU Can you solve this equation?
- hdu 2199 Can you solve this equation?
- HDU 2199-Can you solve this equation?
- hdu 2199 Can you solve this equation?
- hdu 2199 can you solve this equation
- HDU 2199 Can you solve this equation?
- HDU 2199 Can you solve this equation?
- hdu 2199 Can you solve this equation?
- HDU 2199 Can you solve this equation?
- HDU 2199 Can you solve this equation?
- HDU 2199 Can you solve this equation?
- hdu 2199 Can you solve this equation?
- Centos 7 下配置codeblocks13.12的googletest单元测试环境
- 二叉树较全介绍
- 深度学习在做什么
- anjularJS模块
- char(串口)输出转换为float型
- hdu step 4.1.1Can you solve this equation?
- ORACLE SQL性能优化汇总
- 在IIS6.0中无法下载的问题
- 【Visual C++】游戏编程学习笔记之三:游戏循环的使用
- Android中状态栏的隐藏
- 广义线性模型与Logistic回归
- 代理模式
- 六、oc中构造方法的学习
- cocoaPods 使用