This problem’s author is too lazy to write the problem description, so he only give you a equation like X (eY) == (eY) x, and the value of Y, your task is calculate the value of X.

Note : here e is the Natural logarithm.

Input

Each line will contain one number Y(Y >= 1). Process to end of file.

Output

For each case, output X on one line, accurate to five decimal places, if there are many answers, output them in increasing order, if there is no answer, just output “Happy to Women’s day!”.

Sample Input

1

Sample Output

2.71828

二分就好了,只有1的时候才只有一个答案,其他都是2个,注意输出5位小数我是个傻子

#include<iostream>
#include<stdio.h>
#include<stdlib.h>
#include <iomanip>
#include<cmath>
#include<float.h>
#include<string.h>
#include<algorithm>
#define sf scanf
#define pf printf
#define pb push_back
#define mm(x,b) memset((x),(b),sizeof(x))
#include<vector>
#include<map>
#define for(i,a,b) for(int i=a;i<b;i++)
typedef long long ll;
typedef long double ld;
typedef double db;
const ll mod=1e12+100;
const db e=exp(1);
using namespace std;
const double pi=acos(-1.0);
db ans;
int judge(db mid)
{
db cas=log(mid)/mid;
if(cas==ans) return 0;
else if(cas<ans) return -1;
else if(cas>ans) return 1;
}
int main()
{
db x,y;
while(~sf("%lf",&y))
{
if(y==1)
{
pf("%.5lf\n",e);continue;
}
ans=(1+log(y))/(e*y);
db left=1,right=e,mid;
while(right-left>0.00000001)
{
mid=(left+right)/2;
if(judge(mid)==0) break;
else if(judge(mid)==1) right=mid;
else left=mid;
}
pf("%.5lf ",mid);
left=e,right=DBL_MAX;
while(right-left>0.00000001)
{
mid=(left+right)/2;
if(judge(mid)==0) break;
else if(judge(mid)==1) left=mid;
else right=mid;
}
pf("%.5lf\n",mid);
}
return 0;
}

D - Equation Again的更多相关文章

  1. CodeForces460B. Little Dima and Equation

    B. Little Dima and Equation time limit per test 1 second memory limit per test 256 megabytes input s ...

  2. ACM: FZU 2102 Solve equation - 手速题

     FZU 2102   Solve equation Time Limit:1000MS     Memory Limit:32768KB     64bit IO Format:%I64d & ...

  3. HDU 5937 Equation

    题意: 有1~9数字各有a1, a2, -, a9个, 有无穷多的+和=. 问只用这些数字, 最多能组成多少个不同的等式x+y=z, 其中x,y,z∈[1,9]. 等式中只要有一个数字不一样 就是不一 ...

  4. coursera机器学习笔记-多元线性回归,normal equation

    #对coursera上Andrew Ng老师开的机器学习课程的笔记和心得: #注:此笔记是我自己认为本节课里比较重要.难理解或容易忘记的内容并做了些补充,并非是课堂详细笔记和要点: #标记为<补 ...

  5. CF460B Little Dima and Equation (水题?

    Codeforces Round #262 (Div. 2) B B - Little Dima and Equation B. Little Dima and Equation time limit ...

  6. Linear regression with multiple variables(多特征的线型回归)算法实例_梯度下降解法(Gradient DesentMulti)以及正规方程解法(Normal Equation)

    ,, ,, ,, ,, ,, ,, ,, ,, ,, ,, ,, ,, ,, ,, ,, ,, ,, ,, ,, ,, ,, ,, ,, ,, ,, ,, ,, ,, ,, ,, ,, ,, ,, , ...

  7. 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 ...

  8. [ACM_数学] Counting Solutions to an Integral Equation (x+2y+2z=n 组合种类)

    http://acm.hust.edu.cn/vjudge/contest/view.action?cid=27938#problem/E 题目大意:Given, n, count the numbe ...

  9. hdu 2199 Can you solve this equation?(二分搜索)

    Can you solve this equation? Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K ( ...

  10. SGU 106 The equation

    H - The equation Time Limit:250MS     Memory Limit:4096KB     64bit IO Format:%I64d & %I64u Subm ...

随机推荐

  1. 递归删除服务器log文件

    ## 进入logs根文件夹 cd /home/admin/logs ## 删除所有的log文件 find . -name "*.log.*" | xargs rm -f

  2. 求标准分sql

    if object_id('tempdb..#tempTable') is not null Begin drop table #tempTable End [校区],[学年],[考试年级],[考试类 ...

  3. Qt只QSetting

    The QSettings class provides persistent platform-independent application settings. 提供跨平台的持久性设置. QSet ...

  4. CentOS 7.4安装Nginx 1.14.0

    一.安装所需环境   1.gcc 安装         yum install gcc-c++    

  5. ajax之async属性

    Ajax请求中的async:false/true的作用 官方的解释是:http://api.jquery.com/jQuery.ajax/ async Boolean Default: true By ...

  6. 检查死锁与Locked ownable synchronizers(转载)

    通过jstack可快速检查线程的死锁信息,用法如下: # 获取JVM ID(JAVA 进程ID),通过参数lv可以获取更详细的JAVA方法调用信息 jps -lv # 得到JVM ID后,执行jsta ...

  7. 湾区求职分享:三个月刷题拿到 Google offer,欢迎踊跃提问

    本文仅以个人经历和个人观点作为参考.如能受益,不胜荣幸. 本文会不断的修正,更新.希望通过大家的互动最后能写出一份阅者受益的文章. 本文纯手打,会有错别字,欢迎指出,虚心接受及时更改. 小马过河,大牛 ...

  8. CSS中的继承

    继承:子元素继承父元素的样式,但是并不是所有属性都是默认继承的. 通过文档中的 inherited:yes 来判断属性是否可以继承,关于继承可以参见css的继承关键字: 一.无继承性的属性 1.dis ...

  9. 用VS2012建立core2.1网站项目后引用Microsoft.AspNetCore.Session不了

    做个.NET CORE的新项目,和往常一样,VS2017新建CORE项目(CORE2.1),NUGET引入session,结果引入不了,说什么版本不对应的,把SESSION降了一个版本,可以安装上了, ...

  10. [k8s]k8s pod的4种网络模式最佳实战(externalIPs )

    hostPort相当于docker run -p 8081:8080,不用创建svc,因此端口只在容器运行的vm上监听 缺点: 没法多pod负载 $ cat pod-hostport.yaml api ...