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. iOS开发-适配器和外观模式

    适配器模式,属于结构型模式,其主要作用是将一个类的接口转换成客户希望的另外一个接口.适配器模式使得原本由于接口不兼容而不能一起工作的那些类可以一起工作.适配器模式有对象适配器和类适配器两种,类适配器模 ...

  2. [Canvas]炸弹人初成版

    试玩请点此下载代码,并使用浏览器打开index.html. 用方向键操作小人,空格键放炸弹,把敌人消灭算赢,被炸弹炸中或是碰到敌人算输. 图例: 源码: <!DOCTYPE html> & ...

  3. 原创:vsphere概念深入系列三:vSphere命令行管理

    假设无法近距离接触物理主机,只能远程命令行管理,. 以下命令行可以起到点作用. 首先需要安装vSphere CLI工具. 启动后界面: 1.查看datastore内容 所有命令行工具都可以加上-ser ...

  4. JNI学习小结

    Java中类型与C/C++中对应关系   Java中的类的对应   Sign签名, 用来识别对应各个方法. JDK下的javap.exe能输出签名.用法javap -s -p 完整类名     下面是 ...

  5. vue中使用some删除list中的数据

    在vue中可以使用some方法查找需要删除的所以 this.list.some((item, i) => { if (item.id == id) { this.list.splice(i, 1 ...

  6. css中border-radius用法详解

    border-radius:由浮点数字和单位标识符组成的长度值.border-top-left-radius --- 左上border-top-right-radius --- 右上border-bo ...

  7. H5的Video事件,控制方法,及监听

    1.标签基本属性 src :视频的属性 poster:视频封面,没有播放时显示的图片preload:预加载autoplay:自动播放loop:循环播放controls:浏览器自带的控制条width:视 ...

  8. 译:1. RabbitMQ Java Client 之 "Hello World"

    这些教程介绍了使用RabbitMQ创建消息传递应用程序的基础知识.您需要安装RabbitMQ服务器才能完成教程 1. 打造第一个Hello World 程序 RabbitMQ是一个消息代理:它接受和转 ...

  9. sql in not in 案例用 exists not exists 代替

    from AppStoke B WHERE B.Opencode=A.Code) in用extist代替 select distinct * from Stoke where Code not in ...

  10. java Filter过滤器例外URL设置

    在web.xml声明的一个filter中: <!– session过滤filter –> <filter> <filter-name>SessionFilter&l ...