mirror of
https://github.com/Kiritow/OJ-Problems-Source.git
synced 2024-03-22 13:11:29 +08:00
7a2a9109f5
2600-2699
41 lines
1020 B
C++
41 lines
1020 B
C++
#include<iostream>
|
|
#include<cmath>
|
|
#include<cstdio>
|
|
using namespace std;
|
|
const double ee=2.718281828459;
|
|
const double eps=1e-7;
|
|
int main()
|
|
{
|
|
double x,y;
|
|
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 Womens 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;
|
|
}
|