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 ...
随机推荐
- Yii防注入攻击笔记
网站表单有注入漏洞须对所有用户输入的内容进行个过滤和检查,可以使用正则表达式或者直接输入字符判断,大部分是只允许输入字母和数字的,其它字符度不允许:对于内容复杂表单的内容,应该对html和script ...
- 如何用Windbg找到被catch住的C++的异常
博客搬到了fresky.github.io - Dawei XU,请各位看官挪步.最新的一篇是:如何用Windbg找到被catch住的C++的异常.
- get和post,session和cookie的一些说明
1.GET和POST的区别 A. 从字面意思和HTTP的规范来看,GET用于获取资源信息而POST是用来更新资源信息. B. GET提交请求的数据实体会放在URL的后面,用?来分割,参数用& ...
- salt-minion安装脚本
#!/bin/bash cd /usr/local/src/ wget http://mirrors.sohu.com/fedora-epel/6/x86_64/epel-release-6-8.no ...
- JavaWeb文件的上传与下载(1)
经常用到的上传: 头像上传,资料分享等 文件上传的步骤 1.指定表单类型为文件上传表单 enctype="multipart/form-data" 2.表单提交方式必须为:post ...
- 判断URL是否能链接成功
判断网络文件 存在 3秒之内返回结果 方法2: /// <summary> /// 判断网络文件是否存在 1.5秒得到出结果 如这样的格式 http:// ...
- Installing the PHP/MongoDB extension on Mac OSX 10.8
Installing PHP/MongoDB extension is a two steps task on OSX: Install the autoconf tool required for ...
- PagerSlidingTabStrip
https://github.com/jpardogo/PagerSlidingTabStrip
- CenOS搭建FTP服务器
CenOS搭建FTP服务器 -------------------------------------------------------------------------准备工作--------- ...
- [React] React Fundamentals: State Basics
State is used for properties on a component that will change, versus static properties that are pass ...