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 ( ...
随机推荐
- 初始化windows窗口
LRESULT WINAPI WndProc(HWND hWnd,UINT msg,WPARAM wParam,LPARAM lParam) { PAINTSTRUCT ps; switch (msg ...
- CSS+DIV 布局三种定位方式
一.普通流 普通流中元素框的位置由元素在HTML中的位置决定.块级元素从上到下依次排列,框之间的垂直距离由框的垂直margin计算得到.行内元素在一行中水平布置. 二.定位 1.相对定位 被看作普通流 ...
- 主机头部分 www有和无是有区别的
关于主机部分www的问题: case 1: frontend web_service bind *:80 bind *:443 ssl crt /etc/haproxy/cert.pem acl ww ...
- 【HDOJ】3948 The Number of Palindromes
后缀数组求不重复回文子串数目.注意dp数组. /* 3948 */ #include <iostream> #include <sstream> #include <st ...
- git rebase无法处理的问题
在进行代码整理的时候,遇到了冲突 现在chucklu_master分支指向这个commit SHA-1: 88fa1ee9263402626d85b5a4362e1b620935953f * remo ...
- Android开发之异步消息处理机制Handler
更加详细的介绍Handler的博文-http://blog.csdn.net/guolin_blog/article/details/9991569 Android中的异步消息处理主要有四个部分组成, ...
- Eclipse插件安装
在线安装(一定要保证网络畅通) 更新插件: Eclipse中,Help->Install New Software...从Work with下拉列表框中选择,通过该列表框可以选择Eclipse已 ...
- struts采用JavaServlet/JSP技术,实现了基于Java EEWeb应用的MVC设计模式的应用框架
今天我用Ecipse搭建Struts框架,并且使用Struts框架编写一个最简单的例子,相信读者能够很容易的明白. Struts是当今Java比较流行的三大框架之一,三大框架是Struts,sprin ...
- jquery 图片放大
上一篇是关于手风琴效果的,但是有时候我们需要放大的图片大小不规律,想要在屏幕中间显示大图. 图片放大可以做为单独的效果,也可以和其他的效果结合起来.比如Demo 里的Demo5.html是以图片无缝切 ...
- 8.8-8.10 usaco
summary:44 没救了...整天刷水迟早药丸! ❤bzoj3892: 区间dp.我原来的思路是dp[i][j]表示前i个数跳过了j次,那么转移可以前k个数转移了j-1次,枚举k就好了,但是这样是 ...