Equation Again
来源:互联网 发布:耐高温密封条 淘宝 编辑:程序博客网 时间:2024/06/14 13:01
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 Sample Output
Note : here e is the Natural logarithm.
1
2.71828
#include <iostream>#include <cmath>#include <cstdio>using namespace std;const double e=2.718281828459;const double eps=1e-7;int main(){ double y; while(cin>>y) { double ans=log(e*y)/(e*y); double left=0,right=e; while(right-left>eps) { double mid=(left+right)/2; double temp=log(mid)/mid; if(temp>=ans)right=mid-eps; else left=mid; } if(fabs(y-1)>eps) printf("%.5f %.5f\n",right,e*y); else printf("%.5f\n",e*y); } return 0;}
注意浮点型的二分。
阅读全文
0 0
- Equation Again
- HDU-2675 Equation Again
- HDU 2675 Equation Again
- Hdoj 2675 Equation Again
- hdu 2675 Equation Again (二分)
- 【hdu2675】Equation Again——二分
- hdu oj 2675 Equation Again(二分)
- HDU 2675 Equation Again 二分求函数零点
- Equation
- Equation
- Again
- Difference Equation
- Batman Equation
- Heat equation
- plane equation
- Create equation
- Plane Equation
- Solve equation
- leetcode[Range Addition II]
- 用js实现自动打字动画效果
- java鬼混笔记:Hibernate:4、多对一
- linux编辑器vim笔记第一节
- 构建根文件系统
- Equation Again
- glibc源码分析之chdir,fchdir,chroot,getcwd
- 过山车
- 整理android逆向工程师技能表 by非虫from看雪
- C语言常用转换说明区别
- servlet监听完成统计在线人数,显示在线人员列表(附源码)
- 第一次只出现一次的字符
- 二叉树中序线索
- 【解决方案】如何解决输入框失焦事件与按钮点击事件冲突的问题