OpenJudge/Poj 1517 u Calculate e
2014-02-20 22:06
453 查看
1.链接地址:
http://bailian.openjudge.cn/practice/1517 http://poj.org/problem?id=1517
2.题目:
3.思路:
4.代码:
http://bailian.openjudge.cn/practice/1517 http://poj.org/problem?id=1517
2.题目:
总时间限制:1000ms内存限制:65536kB描述A simple mathematical formula for e is
e=Σ0<=i<=n1/i!
where
n is allowed to go to infinity. This can actually yield very accurate
approximations of e using relatively small values of n.输入No input输出Output the approximations of e generated by the above formula for
the values of n from 0 to 9. The beginning of your output should appear
similar to that shown below.样例输入
样例输出
来源Greater New York 2000
e=Σ0<=i<=n1/i!
where
n is allowed to go to infinity. This can actually yield very accurate
approximations of e using relatively small values of n.输入No input输出Output the approximations of e generated by the above formula for
the values of n from 0 to 9. The beginning of your output should appear
similar to that shown below.样例输入
no input
样例输出
n e - ----------- 0 1 1 2 2 2.5 3 2.666666667 4 2.708333333 ...
来源Greater New York 2000
3.思路:
4.代码:
#include "stdio.h" //#include "stdlib.h" int main() { int tmp=1; double sum=1; int i=0; printf("n e\n"); printf("- -----------\n"); printf("%d %.10g\n",i,sum); for(i=1;i<10;i++) { tmp*=i; sum+=(double)1/tmp; printf("%d %.10g\n",i,sum); } //system("pause"); return 0; }
相关文章推荐
- Poj OpenJudge 百练 2632 Crashing Robots
- OpenJudge/Poj 1936 All in All
- OpenJudge/Poj 2027 No Brainer
- Poj 2109 / OpenJudge 2109 Power of Cryptography
- OpenJudge / Poj 1044 Date bugs C++
- OpenJudge / Poj 1003 Hangover
- OpenJudge/Poj 1159 Palindrome
- OpenJudge/Poj 1631 Bridging signals
- OpenJudge/Poj 2105 IP Address
- Poj 2586 / OpenJudge 2586 Y2K Accounting Bug
- POJ 1517 u Calculate e
- Poj 1013 Counterfeit Dollar / OpenJudge 1013(2692) 假币问题
- Poj 1054 The Troublesome Frog / OpenJudge 2812 恼人的青蛙
- OpenJudge/Poj 1226 Substrings
- OpenJudge/Poj 1658 Eva's Problem
- OpenJudge / Poj 2141 Message Decowding
- Poj/OpenJudge 1042 Gone Fishing
- poj 1517 & hdu 1012 u Calculate e(简单阶乘)
- POJ(7084)-----迷宫问题(openjudge)
- Poj OpenJudge 1068 Parencodings