博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
poj1905 Expanding Rods
阅读量:6992 次
发布时间:2019-06-27

本文共 800 字,大约阅读时间需要 2 分钟。

精度限定到1e-12即可。

 

 

1 #include 
2 #include
3 4 using namespace std; 5 6 const double pi = 3.14159265359; 7 const double ep = 1e-12; 8 9 double l, n, c;10 11 void solve(){12 double low = ep, high = pi / 2;13 double l1 = (1 + n * c) * l;14 double d1, d2, mid;15 d2 = l / l1;16 while(high - low > ep){17 mid = (low + high) / 2;18 d1 = sin(mid) / mid;19 if(d1 > d2) low = mid;20 else high = mid;21 }22 d1 = sin(low), d2 = sin(low / 2);23 printf("%.3f\n", l * d2 * d2 / d1);24 }25 26 int main(){27 //freopen("in.txt", "r", stdin);28 while(~scanf("%lf%lf%lf", &l, &n, &c) && (l + 1)){29 solve();30 }31 return 0;32 }
View Code

 

转载于:https://www.cnblogs.com/astoninfer/p/4750177.html

你可能感兴趣的文章
iOS开发规范&建议
查看>>
[原]如何为SqlServer2008数据库分配用户
查看>>
【leetcode】Basic Calculator III
查看>>
回归到jquery
查看>>
Visual Studio 2008常见问题
查看>>
【洛谷 P4254】 [JSOI2008]Blue Mary开公司(李超线段树)
查看>>
scrapy初体验 - 安装遇到的坑及第一个范例
查看>>
OC内存管理
查看>>
C#中Split用法
查看>>
3月6日 c#语言
查看>>
[LeetCode] Surrounded Regions, Solution
查看>>
MySQL系列:数据库基本操作(1)
查看>>
hdu1058(dp)
查看>>
android EditText与TextView几个常用的属性
查看>>
SDN第五次上机作业
查看>>
课堂练习
查看>>
Git 工具 - 储藏(Stashing)
查看>>
越狱(快速幂)
查看>>
联合查询的 SQL 语法
查看>>
Python语法
查看>>