2014
02-12

# Equation Again

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.

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

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

1

2.71828

/*

ln(x)/x=(1+ln(y))/(e*y)

*/
#include<iostream>
#include<cmath>
#include<cstdio>
using namespace std;
const double ee=2.718281828459;
const double eps=1e-7;
int main()
{
double x,y;
// for(int i=1;i<=2000;i++)
// cout<<log(i)/(1.0*i)<<endl;
// while(scanf("%lf",&y)!=EOF)
while(scanf("%lf",&y)!=EOF)
{
double tmp=(1+log(y))/(y*ee);
double low=1+eps,hei=ee-eps,mid;
if(tmp*ee-1>eps){puts("Happy to Women’s day!");continue;}
while(hei-low>eps)
{
mid=(hei+low)/2;
if(log(mid)*(y*ee)>(1+log(y))*mid)
hei=mid;
else
low=mid;
}
if(y==1)printf("%.5lf\n",(hei+low)/2);
else  if(y>1)
{
double ans=(hei+low)/2;
low=ee+eps,hei=2000000000+eps;
while(hei-low>eps)
{
mid=(hei+low)/2;
if(log(mid)*(y*ee)<(1+log(y))*mid)
hei=mid;
else
low=mid;
}
printf("%.5lf %.5lf\n",ans,(hei+low)/2);
}
}
return 0;
}

1. 可以根据二叉排序树的定义进行严格的排序树创建和后序遍历操作。如果形成的排序树相同，其树的前、中、后序遍历是相同的，但在此处不能使用中序遍历，因为，中序遍历的结果就是排序的结果。经在九度测试，运行时间90ms，比楼主的要快。

2. 站长，你好！
你创办的的网站非常好，为我们学习算法练习编程提供了一个很好的平台，我想给你提个小建议，就是要能把每道题目的难度标出来就好了，这样我们学习起来会有一个循序渐进的过程！