sicily Computing PI
来源:互联网 发布:最全专业网络投资理财 编辑:程序博客网 时间:2024/06/09 02:42
DescriptionTime Limit: 1sec Memory Limit:256MB
You can approximate PI by using the following series:
PI = 4(1 - 1/3 + 1/5 - 1/7 + 1/9 - ... -1/(2i-1) + 1/(2i+1))
Input
You can approximate PI by using the following series:
PI = 4(1 - 1/3 + 1/5 - 1/7 + 1/9 - ... -1/(2i-1) + 1/(2i+1))
Input
An integer i (0<i<=100000).
The PI value.
You should set the precision to 15.
Sample Input
Copy sample input to clipboard10
3.232315809405593
一开始老是超时,最后放弃了按顺序叠加的方法(因为那要频繁计算一个pow(-1,n)),而是把加法看成两段,奇偶分开算,就没超时了。
0 0
- sicily Computing PI
- Computing PI
- Computing PI using Monte Carlo method
- Sicily 9994. 3. Computing the weekly hours for each employee
- PI
- pi
- Pi
- PI
- pi
- Pi
- Pi
- [pi
- pi
- PI
- Ubiquitous Computing / Pervasive Computing
- Granular Computing
- Autonomic Computing
- Grid Computing
- 关于列表显示带有用户头像的信息加载头像图片(AsyncTask)
- 最大流模板(Dinic算法)
- 通过 WIF 实现基于声明的授权
- Android - View Alpha值
- 网页背景图片不显示的时候怎么使用背景色?
- sicily Computing PI
- SSH框架的学习
- linux执行shell脚本的方式及一些区别
- 常见问题
- hdu 4272
- char型未初始化状态
- WPF 自定义TreeViewItem样式
- 精讲全面解读数据结构第三章栈和队列c++版
- 【 Visual C++】游戏开发笔记之二——最简单的DirectX,vc窗口的编写