HDU 2199 Can you solve this equation? (二分 水题)
Can you solve this equation?
Now please try your lucky.
100
-4
No solution!
一道初学者的二分题,讲课用
#include <iostream>
#include <cstdio>
using namespace std; double y; double getfx(double x){
return 8*x*x*x*x + 7*x*x*x + 2*x*x + 3*x + 6;
} void computing(){
if(getfx(100)<y-1e-3 || getfx(0)>y+1e-3){
printf("No solution!\n");
return;
}
double l=0,r=100;
while(r-l>1e-6){
double mid=(l+r)/2;
if(getfx(mid)>y) r=mid;
else l=mid;
}
printf("%.4lf\n",r);
} int main(){
int t;
scanf("%d",&t);
while(t-- >0){
scanf("%lf",&y);
computing();
}
return 0;
}
HDU 2199 Can you solve this equation? (二分 水题)的更多相关文章
- 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?(二分精度)
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? 二分
Can you solve this equation? Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K ( ...
- 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 ...
- 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?【二分查找】
解题思路:给出一个方程 8*x^4 + 7*x^3 + 2*x^2 + 3*x + 6 == Y,求方程的解. 首先判断方程是否有解,因为该函数在实数范围内是连续的,所以只需使y的值满足f(0)< ...
- hdu 2199 Can you solve this equation?(二分搜索)
Can you solve this equation? Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K ( ...
随机推荐
- Oracl 动态执行表不可访问,本会话的自动统计被禁止
oracle ---建立SQL窗体 写入 select * from tableA; 弹出错误窗口 : 动态执行表不可访问,本会话的自动统计被禁止.在执行菜单里你可以禁止统计,或在v$session, ...
- Android之AlertDialog.Builder详解
import android.app.Activity; import android.app.AlertDialog; import android.content.DialogInterface; ...
- html元素elem.style.top.left始终为空
有如下元素: <div id="div1" >div1</div> #div1{ width:100px; height:100px; position ...
- Android开发之多媒体编程之加载大分辨率图片
Android中图片占用内存的大小=图片的总像数*每个像数占用的大小. Android保存图片像素信息使用ARGB,意思是每个像素占用4个字节. 以分辨率为2400*3200的图片来说,加载到Andr ...
- 转 Android adb root权限
永久root带文件 因为开发需要,我经常会用到adb这个工具(Android Debug Bridge),我们都知道adb shell默认是没有root权限的,修改系统文件就很不方便了,adb pus ...
- POJ 2352 Stars
题意:有一堆星星,每个星星的级别为坐标不高于它且不在它右边的星星个数,求级别为0-n - 1的星星个数. 解法:树状数组.输入的星星坐标已经按y坐标升序排序,y坐标相等的按x升序排序,所以每输入一个数 ...
- keybd_event跟SendMessage,PostMessage模拟键盘消息的区别 z
首先你会发现keybd_event函数中是没有窗口句柄作为参数的,好奇的你一定会觉得很奇怪,那是因为,keybd_event是全局模拟按键的,只对前台窗口(即当前的活动窗口)才可以,但是如果模拟的按键 ...
- HDU 5699 货物运输 二分判定
转自:http://blog.csdn.net/jtjy568805874/article/details/51480479 #include <cstdio> #include < ...
- HDU4612 Warm up 边双(重边)缩点+树的直径
题意:一个连通无向图,问你增加一条边后,让原图桥边最少 分析:先边双缩点,因为连通,所以消环变树,每一个树边都是桥,现在让你增加一条边,让桥变少(即形成环) 所以我们选择一条树上最长的路径,连接两端, ...
- 特效TD 的工作准则
特效 TD 的工作准则 作者:Hammer Chen / 转载自 http://hammerbchen.blogspot.com/2013/07/vfx-td-td.html 一直以来都想写这样的文章 ...