poj1936(公式+二分)
2016-03-29 18:58
148 查看
参考(/article/1968942.html)
#include <iostream> #include <bitset> #include <vector> #include <algorithm> #include <cstdio> #include <cstring> #include <cmath> #include <iomanip> using namespace std; double l,n,c; double eps = 1e-6; int main() { while (cin>>l>>n>>c) { if (l<0&&n<0&&c<0) { break; } double s = (1+n*c)*l; double ma = l/2,mi = 0; double mid = (ma+mi)/2; while (ma-mi>eps) { mid = (ma+mi)/2; double r = (4*mid*mid+l*l)/8/mid; if (s-2*r*asin(l/2/r)>eps) { mi = mid; } else ma = mid; } cout<<fixed<<setprecision(3)<<mid<<endl; } return 0; }
相关文章推荐
- #Paper Reading# Clustering by fast search and find of density peaks
- [Java] 实验5参考代码
- 第三周 项目4(4)委派任务
- 项目15-游戏中的角色类(2)
- 为sublime Text3 安装插件JS Format
- Android面试
- Android 6.0 运行时权限处理
- 复杂一点的 listview + header实现 上拉下拉刷新就行了
- 第五周项目一-三角形类雏形(4)
- 0328-复利计算单元测试
- mybatis和spring学习
- 基于springMVC的微信支付(V3版本)
- 第五周项目一-三角形类雏形(3)
- 一篇很全面的freemarker教程
- 欢迎使用CSDN-markdown编辑器
- python正则表达式(关于re)
- #定位系统性能瓶颈# strace & ltrace
- 字符串的包含
- OC-通知+Block
- Mac 解决svn+Cornerstone中 UserInterfaceState.xcuserstate的版本控制