I - u Calculate e
Description
where n is allowed to go to infinity. This can actually yield very accurate approximations of e using relatively small values of n.
Output
Sample Output
#include<iostream>
#include<iomanip>
using namespace std;
double f(int n)
{
long double a=;
for(int i=;i<=n;i++)a*=i;
return a;
}
int main()
{
cout << "n e"<<endl<<"- -----------"<<endl;
double e=;
cout<<<<" "<<e<<endl;
for(int i=;i<=;++i)
{
e+=/f(i);
cout<<i<<" ";
if(i!=) cout<<setprecision()<<e<<endl;
else cout<<setprecision()<<e<<<<endl;
}
//system("pause");
return ;
}
不难!!不要忘了long double !!!!
I - u Calculate e的更多相关文章
- [转] PHP计算两个坐标之间的距离, Calculate the Distance Between Two Points in PHP
Calculate the Distance Between Two Points in PHP There are a lot of applications where it is useful ...
- CoreException: Could not calculate build plan: Plugin org.apache.maven.plugins:maven-compiler-plugin:3.1 or one of its dependencies could not be resolved
CoreException: Could not calculate build plan: Plugin org.apache.maven.plugins:maven-compiler-plugin ...
- maven -- 问题解决(二)解决“Could not calculate build plan”问题
错误提示如下:(eclipse+maven) Could not calculate build plan: Failure to transfer org.apache.maven.plugins: ...
- 线段树 + 矩阵 --- ZOJ 3772 Calculate the Function
Calculate the Function Problem's Link: http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemCod ...
- hdu 1012:u Calculate e(数学题,水题)
u Calculate e Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Tot ...
- Calculate its MTBF assuming 2000 FITS for each DRAM
COMPUTER ORGANIZATION AND ARCHITECTURE DESIGNING FOR PERFORMANCE NINTH EDITION A common unit of meas ...
- u Calculate e 分类: HDU 2015-06-19 22:18 14人阅读 评论(0) 收藏
u Calculate e Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) Total ...
- How to calculate a good InnoDB log file size
Peter wrote a post a while ago about choosing a good InnoDB log file size. Not to pick on Peter, b ...
- Calculate the formula
Problem Description You just need to calculate the sum of the formula: 1^2+3^2+5^2+……+ n ^2. Input ...
- How to Calculate difference between two dates in C# z
Do you need to find the difference in number of days, hours or even minute between the two date rang ...
随机推荐
- php+mysql将大数据sql文件导入数据库
<?php $file_name = "d:test.sql"; $dbhost = "localhost"; $dbuser = "root& ...
- node.js + socket.io实现聊天室一
前段时间,公司打算在社区做一个聊天室.决定让我来做.本小白第一次做聊天类功能,当时还想着通过ajax请求来实现.经过经理提示,说试试当前流行的node.js 和socket.io来做.于是就上网学习研 ...
- php代码-1
- NAS4Free 安装配置(二)系统安装
NAS4Free系统安装 看一看BIOS设置 开机按DEL进BIOS 改日期时间 这里可以设置RAID,因为ZFS的RAID功能更好,所以我们在这里不配置RAID 制作LiveUSB 用软件(USB ...
- linux下snprintf和sprinf很少被提及的区别
函数原型:int snprintf(char *dest, size_t size, const char *fmt, ...);函数说明: snprintf函数中的第二个参数,size的解释:siz ...
- [Codeforces Round #186 (Div. 2)] B. Ilya and Queries
B. Ilya and Queries time limit per test 2 seconds memory limit per test 256 megabytes input standard ...
- php平台移植windows和linux
2015/1/14 今天项目中遇到一个问题,在本地运行没有问题,挂到服务器上,就运行错误.过程中比较粗心,知道导致这样的原因,居然小时漏掉了一些细节. 比如,在php中通过声明__autoload() ...
- WPF笔记(2.9和2.10)——Layout
原文:WPF笔记(2.9和2.10)--Layout 2.9讲的是,如果内部设定超过容器大小,怎么办?StackPanel会裁剪越界部分DockPanel和Grid会智能判断,从而决定换行. 2.10 ...
- 一篇非常经典的springMVC注解实现方式详解
今天公司让搭建个springMVC的注解框架,研究了好半天,网络搜罗了半天,好不容易找到篇,拿来分享下: 原文出处:http://itxxz.com/a/kuangjia/2014/0531/4.ht ...
- mongodb----pymongo的用法
pymongo是python的一个模块,可能通过sudo pip install pymongo来安装. 导入pymongo import pymongo 创建连接 conn = pymongo.Co ...