Day3-K-Can you solve this equation? HDU2199
Now please try your lucky.
InputThe first line of the input contains an integer T(1<=T<=100) which means the number of test cases. Then T lines follow, each line has a real number Y (fabs(Y) <= 1e10);OutputFor each test case, you should just output one real number(accurate up to 4 decimal places),which is the solution of the equation,or “No solution!”,if there is no solution for the equation between 0 and 100.Sample Input
2
100
-4
Sample Output
1.6152
No solution! 思路:二分查找答案问题,设置精度后直接查找即可,代码如下:
double Y; double check(double x) {
return * (x * x * x * x) + * (x * x * x) + * (x * x) + * x + ;
} int main() {
int T;
scanf("%d", &T);
while(T--) {
double l = 0.0, r = 100.0, mid;
scanf("%lf", &Y);
if(check(0.0) > Y || check(100.0) < Y) {
printf("No solution!\n");
continue;
}
while(r - l > 1e-) {
mid = (r + l) / 2.0;
if(check(mid) - Y > )
r = mid;
else
l = mid;
}
printf("%.4lf\n", mid);
}
return ;
}
Day3-K-Can you solve this equation? HDU2199的更多相关文章
- 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的 ...
- 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?(高精度二分)
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? (二分 水题)
Can you solve this equation? Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K ( ...
- hdoj 2199 Can you solve this equation?【浮点型数据二分】
Can you solve this equation? Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K ( ...
- Can you solve this equation?
Can you solve this equation? Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Jav ...
- HDU 2199 Can you solve this equation(二分答案)
Can you solve this equation? Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K ( ...
随机推荐
- Cisco AP-如何识别思科胖瘦AP
思科的胖瘦AP识别的方式不止一种,这里简单的总结一些我了解到的方式: 1.根据思科AP的型号 这个和思科不同时期的产品有关系,老一点的和新一些的AP命名上存在差别,这里简单举例: 类型1:AIR-LA ...
- rtt学习之线程间同步与通信
一 线程间的同步与互斥:信号量.互斥量.实践集 线程互斥是指对于临界区资源访问的排它性,如多个线程对共享内存资源的访问,生产消费型对产品的操作.临界区操作操作方法有: rt_hw_interrupt_ ...
- django 模版标签笔记
一.模板变量笔记:1.在模版中使用变量,需要将变量放到‘{{}}’中.'{{ 变量 }}'2.如果想访问对象的属性,可以通过'对象.属性名'的方式访问3.如果想要访问一个字典的key对应的value, ...
- UINavigationController+FDFullscreenPopGesture全屏回滑手势阅读理解
滑动返回纯oc.纯swifthttps://github.com/Bonway/BBGestureBack UINavigationController+FDFullscreenPopGesture全 ...
- 创业复盘实战营总结----HHR计划----创业课
一句话总结课程核心点. 一共4节在线课: 第一节课:<创业学习> 投资人最看重的是CEO的快速学习能力,根据IPO思维模型,如果一共CEO每天input大量的信息,高效的process,而 ...
- vue父孙组件传值($attr及$listeners)的使用
父组件 <template> <div> <!-- 将值传给子组件 子组件可以获取自己想要的值 也可以忽视掉需要传给孙子组件的值 --> <!-- 同时获取通 ...
- VSCode 出现错误 System.IO.IOException: The configured user limit (128) on the number of inotify instances has been reached.
方案一: sudo vim /etc/sysctl.conf 增加下面内容(环境变量) fs.inotify.max_user_watches = 1638400 fs.inotify.max_use ...
- 最大流dinic板子
题目: https://www.luogu.com.cn/problem/P3376 #include <bits/stdc++.h> using namespace std; ; con ...
- 3_03_MSSQL课程_Ado.Net_数据导入
数据库数据导出和导入 思路: --思路: 1.找到文件 2.读取文件 3.第一行 忽略 4.insert using System; using System.Collections.Generic; ...
- Excel使用小技巧
1.Excel随机设置单元格的内容为整数0或1: 在单元格中写公式: =ROUND(RAND(),0) 2.设置某个单元格的值为1或0,根据其他3个单元格的值为0或1来确定: 在该单元格中写公式: ...