OpenJudge/Poj 1517 u Calculate e
1.链接地址:
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.- 样例输入
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=;
double sum=;
int i=;
printf("n e\n");
printf("- -----------\n");
printf("%d %.10g\n",i,sum);
for(i=;i<;i++)
{
tmp*=i;
sum+=(double)/tmp;
printf("%d %.10g\n",i,sum);
}
//system("pause");
return ;
}
OpenJudge/Poj 1517 u Calculate e的更多相关文章
- poj 1517 u Calculate e
u Calculate e Time Limit: 1000MS Memory Limit: 10000K Total Submissions: 19465 Accepted: 11362 ...
- poj 1517 u Calculate e(精度控制+水题)
一.Description A simple mathematical formula for e is e=Σ0<=i<=n1/i! where n is allowed to go t ...
- OpenJudge/Poj 1915 Knight Moves
1.链接地址: http://bailian.openjudge.cn/practice/1915 http://poj.org/problem?id=1915 2.题目: 总Time Limit: ...
- OpenJudge/Poj 1004 Financial Management
1.链接地址: http://poj.org/problem?id=1004 http://bailian.openjudge.cn/practice/1004 2.题目: 总时间限制: 1000ms ...
- OpenJudge / Poj 1044 Date bugs C++
链接地址: Poj:http://poj.org/problem?id=1044 OpenJudge:http://bailian.openjudge.cn/practice/1044/ 题目: 总时 ...
- OpenJudge / Poj 2141 Message Decowding
1.链接地址: http://poj.org/problem?id=2141 http://bailian.openjudge.cn/practice/2141/ 2.题目: Message Deco ...
- OpenJudge/Poj 2105 IP Address
1.链接地址: http://poj.org/problem?id=2105 http://bailian.openjudge.cn/practice/2105 2.题目: IP Address Ti ...
- OpenJudge/Poj 2027 No Brainer
1.链接地址: http://bailian.openjudge.cn/practice/2027 http://poj.org/problem?id=2027 2.题目: 总Time Limit: ...
- OpenJudge/Poj 2013 Symmetric Order
1.链接地址: http://bailian.openjudge.cn/practice/2013 http://poj.org/problem?id=2013 2.题目: Symmetric Ord ...
随机推荐
- Nyoj42 一笔画问题 (欧拉道路)
http://acm.nyist.net/JudgeOnline/problem.php?pid=42题目链接 #include <cstdio> #include <cstring ...
- ZOJ-3720 Magnet Darts 计算几何,概率
题目链接:http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemCode=3720 题意:在一个矩形区域投掷飞镖,每个整点有磁性,每个点的磁性 ...
- Android: Dragging Popup Window 可移动浮动View
final View cv = new View(this); setContentView(cv); TextView tv = new TextView(this); tv.setBackgrou ...
- IOS学习笔记38--@class #import辨析 #include
tyle="margin:20px 0px 0px; line-height:26px; font-family:Arial"> #include 区分 #i ...
- freemarker list (长度,遍历,下标,嵌套,排序)
1. freemarker获取list的size : Java ArrayList<String> list = new ArrayList<String>(); Freema ...
- 自己写的一个Js小插件
这是效果图.上面一个过滤标签.下面弹出框,选择日,周,月.我的用途主要是报表查询的时候根据这3种类型来查询数据用的. 这里分享下代码. Js代码 (function ($) { $.extend($. ...
- 织梦/dedecms 当文章转载时不需要设置图片水印的设置,取消’图片是否加水印‘的复选框,并且修改如下文件即可生效
当想添加水印是选中“图片是否加水印”复选框即可. 找到include/helpers/image.helper.php这个文件,在里面找到中的if( isset($GLOBALS['needwater ...
- JNI 技术与 Android 应用
1. 什么是 JNI JNI是Java Native Interface的缩写.从Java 1.1开始,JNI标准成为java平台的一部分,它允许Java和其他语言进行交互.JNI一开始为C和C++而 ...
- [Javascript] Adding Shapes to Maps with Leaflet and GeoJSON
<!DOCTYPE html> <html> <head lang="en"> <meta charset="UTF-8&quo ...
- 原创C# 枚举 多状态 操作
C# 中枚举类型是一种值类型,目前(vs2012)还不能用于泛型. 此类型最多的用处是标识一组相同类型的状态量或常量,比如: 状态量 示例一 [Flags] public enum Connectio ...