二分-D - Can you solve this equation?
D - Can you solve this equation?
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;
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!
- #include<iostream>
- #include<cmath>
- using namespace std;
- double f(double x){
- return (*pow(x,) + *pow(x,) + *pow(x,) + *x + );
- }
- int main()
- {
- int t;
- double m,n;
- scanf("%d",&t);
- while(t--){
- scanf("%lf",&m);
- if(f()>m||f()<m){
- printf("No solution!\n");
- continue;
- }
- double left = , right = , mid;
- while(fabs(f(mid)-m) > 1e-){
- mid=(left + right)/;
- if((f(mid) > m)) right = mid;
- else if(f(mid)<m) left=mid;
- }
- printf("%.4lf\n",mid);
- }
- return ;
- }
二分-D - Can you solve this equation?的更多相关文章
- 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 ( ...
- hdu2199Can 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 ...
- 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/1000ms (Java/Other) Memory Limit : 32768/32768K (Ja ...
- 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 == ...
随机推荐
- PMP--1.3 项目环境
项目所处的环境可能对项目的开展产生有利或不利的影响.影响项目的环境因素==项目经理在项目期间需要考虑的因素.这些因素不需要死记硬背,需要有一定了解就可以,在项目开始前针对文中内容提前把环境了解清楚,并 ...
- 一套很有意思的C语言测试题目
网络上逛博客,发现了一套很有意思的测试题目: https://kobes.ca/ 大家有兴趣可以做一下,考一些关于C语言使用的细节: 中文翻译参考: https://www.cnblogs.com/l ...
- uniapp后台api设计(微信user表)
MySQL 创建数据库: CREATE DATABASE [IF NOT EXISTS] <数据库名> [[DEFAULT] CHARACTER SET <字符集名>] [[ ...
- C# Winform初体验
设计一个简单的登录窗口,要求输入用户名:小金,密码:123456时候点登录能正确转到另一个窗口. 1.建立窗体应用. 2.这里创建一个login和一个NewForm的窗体. 3.在login的窗体拖拉 ...
- C# 如何获取日期时间各种方法
我们可以通过使用DataTime这个类来获取当前的时间.通过调用类中的各种方法我们可以获取不同的时间:如:日期(2019-01-09).时间(16:02:12).日期+时间(2019-01-09 16 ...
- 一个margin就可以让块状元素响应居中,很实用
之前总结过水平居中的很多方法,但今天在<css世界>这本书里看到margin的一个特性,一行代码就搞定很实用,分享一下 margin: auto能在块级元素设定宽高之后自动填充剩余宽高.m ...
- Spring Aop和Spring Ioc(二)
Spring IOC: DI注入集合类型: 实体类: package cn.spring.entity; import java.util.*; public class Dientity { pri ...
- C#调用Crypto++库AES ECB CBC加解密
本文章使用上一篇<C#调用C++类库例子>的项目代码作为Demo.本文中,C#将调用C++的Crypto++库,实现AES的ECB和CBC加解密. 一.下载Crypto 1.进入Crypt ...
- 《操作系统真象还原》MBR
以下是读本书第三章的收获. 如何知道一个源程序的各符号(指令和变量)地址?简单来说,地址就是该符号偏移文件开头的距离,符号的地址是按顺序编排的,所以两个相邻的符号,其地址也是相邻的.对于指令来说,指令 ...
- 安装Bind到CentOS(YUM)
运行环境 系统版本:CentOS Linux release 7.3.1611 (Core) 软件版本:Bind-x 硬件要求:无 安装过程 1.配置YUM源 [root@localhost ~]# ...