HDU 2199 (二分法)
主要思想就是两端逼近,最后得到结果,0MS
#include <iostream>
#include <cstdlib>
#include <cstdio>
#include <cmath>
#include <algorithm> using namespace std; const double ep = 1e-; double deal(double n)
{
return *pow(n,) + *pow(n,) + *pow(n,) + *n + ; } int main()
{
int t,i;
double y;
scanf("%d",&t);
while (t--)
{
scanf("%lf",&y);
double lo = ,hi = ;
if(y<deal() || y>deal())
{
printf("No solution!\n");
continue;
}
else
{
double mid;
while(hi-lo>ep)
{
mid = (lo+hi)/;
if(deal(mid)>y)
{
hi = mid;
}
else
{
lo = mid;
}
}
printf("%.4lf\n",hi);
} }
return ;
}
HDU 2199 (二分法)的更多相关文章
- 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?(二分法求多项式解)
题意 给Y值,找到多项式 8*x^4 + 7*x^3 + 2*x^2 + 3*x + 6 == Y 在0到100之间的解. 思路 从0到100,多项式是单调的,故用二分法求解. 代码 double c ...
- hdu 2199 (二分)
链接:http://acm.hdu.edu.cn/showproblem.php?pid=2199 Can you solve this equation? Time Limit: 2000/1000 ...
- 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 ...
- (二分搜索)Can you solve this equation? -- hdu -- 2199
链接: http://acm.hdu.edu.cn/showproblem.php?pid=2199 Time Limit: 2000/1000 MS (Java/Others) Memory ...
- 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 ...
- hdu 6288(二分法加精度处理问题)
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=6288 题意:给出a,b,k,n可满足(n^a)*(⌈log2n⌉)^b<=k ,求最大的n值三个 ...
- hdu 2199:Can you solve this equation?(二分搜索)
Can you solve this equation? Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K ( ...
随机推荐
- CentOS6.5加域
为减少错误已提前关掉了SELinux,防火墙. yum install nss-pam-ldapd -y 第一步:更改主机名为linux.itxdm.me 第二步:更改setup内左边Winbind ...
- 爬虫3:requests库
一个简单易用的http库,多用于第一步,爬取网站源码 简单例子 import requests response = requests.get('https://www.baidu.com ...
- C语言数据结构之哈夫曼树及哈夫曼编码的实现
代码清单如下: #pragma once #include<stdio.h> #include"stdlib.h" #include <string.h> ...
- Machine learning 第7周编程作业 SVM
1.Gaussian Kernel function sim = gaussianKernel(x1, x2, sigma) %RBFKERNEL returns a radial basis fun ...
- Sci-Hub
提到Sci-Hub这个文献下载利器,大家肯定都不陌生.你在各大SCI杂志上看到的英文文献,90%以上都能免费下载.因为它严重侵犯了爱思唯尔.施普林格.Wiley等各大出版商的利益,遭到起诉与封杀. 不 ...
- HDU - 6133 启发式合并
题意:给出一棵树共\(n\)个顶点,每个顶点有一个权值\(val_i\),你需要对每个节点统计一个最优解 每个节点的解按照一定规则产生:取出该节点的子树下所有的顶点,把顶点任意排序成一个序列,设为\( ...
- LTE:EPC
User Identifiers - IMSI and GUTI IMSI A globle id that unique identifies a subscribe.It composed t ...
- oracle创建表空间个用户四部曲
/*分为四步 *//*第1步:创建临时表空间 */create temporary tablespace user_temp tempfile 'D:\oracle\oradata\Oracle9 ...
- net与树莓派的情缘-安装与卸载MySql(五)
安装MySql sudo apt-get install mysql-server 删除 mysql sudo apt-get autoremove --purge mysql-server-5.0s ...
- C# .net 使用正则表达式去掉字符串中的数字
/// <summary>/// 去掉字符串中的数字/// </summary>/// <param name="key"></param ...