Problem Description
A simple mathematical formula for e is

where n is allowed to go to infinity.
This can actually yield very accurate approximations of e using relatively small
values of n.

 
Output
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.
Sample Output
n e
- -----------
0 1
1 2
2 2.5
3 2.666666667
4 2.708333333
#include<iostream>
#include <iomanip> using namespace std; int main()
{
int i,n;
double s,t;
cout<<"n e"<<endl;
cout<<"- -----------"<<endl;
cout<<"0 1"<<endl;
cout<<"1 2"<<endl;
cout<<"2 2.5"<<endl;
s=2.5;
n=;
for(i=; i<=; i++)
{
n=i*n;
s+=1.0/n;
cout<<i<<" "<<fixed<<setprecision()<<s<<endl;
}
return ;
}

hdoj1012--u Calculate e的更多相关文章

  1. HDOJ-1012 u Calculate e(水)

    http://acm.hdu.edu.cn/showproblem.php?pid=1012 简单套公式 # include <stdio.h> double Factorial(doub ...

  2. [转] 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 ...

  3. 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 ...

  4. maven -- 问题解决(二)解决“Could not calculate build plan”问题

    错误提示如下:(eclipse+maven) Could not calculate build plan: Failure to transfer org.apache.maven.plugins: ...

  5. 线段树 + 矩阵 --- ZOJ 3772 Calculate the Function

    Calculate the Function Problem's Link:   http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemCod ...

  6. hdu 1012:u Calculate e(数学题,水题)

    u Calculate e Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Tot ...

  7. Calculate its MTBF assuming 2000 FITS for each DRAM

    COMPUTER ORGANIZATION AND ARCHITECTURE DESIGNING FOR PERFORMANCE NINTH EDITION A common unit of meas ...

  8. 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 ...

  9. 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 ...

  10. Calculate the formula

    Problem Description You just need to calculate the sum of the formula: 1^2+3^2+5^2+……+ n ^2.   Input ...

随机推荐

  1. 《从零开始学Swift》学习笔记(Day 14)——字符串的插入、删除和替换

    原创文章,欢迎转载.转载请注明:关东升的博客 对应可变字符串可以插入.删除和替换,String提供了几个方法可以帮助实现这些操作.这些方法如下: splice(_:atIndex:).在索引位置插入字 ...

  2. API网关性能比较:NGINX vs. ZUUL vs. Spring Cloud Gateway vs. Linkerd API 网关出现的原因

    API网关性能比较:NGINX vs. ZUUL vs. Spring Cloud Gateway vs. Linkerd http://www.infoq.com/cn/articles/compa ...

  3. 解决IE,z-index失效

    在影响显示顺序的模块加上: style="position:relative;z-index:-1;" 解决IE,z-index失效

  4. win7安装composer

    安装前请务必确保已经正确安装了 PHP.打开命令行窗口并执行 php -v 查看是否正确输出版本号. 开始安装前需要把open_ssl扩展打开 打开命令行并依次执行下列命令安装最新版本的 Compos ...

  5. 002-maven修改仓库以及镜像地址

    1.将下载好的maven,修改配置 <localRepository>G:\mavenrepository-idea</localRepository> 2.修改增加镜像地址 ...

  6. cut命令学习

    cut最基本的用法: -f 列号:提取第几列 -d 分隔符:按照指定分隔符分割列(默认是制表符tab) 测试用例:(制表符)

  7. Python进阶(5)_进程与线程之协程、I/O模型

    三.协程 3.1协程概念 协程:又称微线程,纤程.英文名Coroutine.一句话说明什么是线程:协程是一种用户态的轻量级线程. 协程拥有自己的寄存器上下文和栈.协程调度切换时,将寄存器上下文和栈保存 ...

  8. centos 6.5 设置屏幕保护

    设置屏幕保护:System -> Preferences -> Screensaver.如果需要取消屏幕保护的锁定功能,将Lock screen when screensaver is a ...

  9. PAT 天梯赛 L1-023. 输出GPLT 【水】

    题目链接 https://www.patest.cn/contests/gplt/L1-023 AC代码 #include <iostream> #include <cstdio&g ...

  10. <script>放在head内和body内有什么区别

    加载的顺序不一样,你可以把HTML看成从上往下加载的. 例如在网速慢的情况下把js代码放在body底部用户会先看到网页结构,等js加载完成后才出现特效 区别简述: 在HTML body部分中的Java ...