HDU 1012 u Calculate e
来源:互联网 发布:linux ping不通百度 编辑:程序博客网 时间:2024/06/05 00:43
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.
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 11 22 2.53 2.6666666674 2.708333333题意即为输出n从0~~9所对应的e的值#include<stdio.h>#include<string.h>#include<math.h>#include<iostream>#include<algorithm>#include<string>using namespace std;int main(){ double e,n; cout<<"n"<<" "<<"e"<<endl;; cout<<"- -----------"<<endl; cout<<"0 1"<<endl; cout<<"1 2"<<endl; cout<<"2 2.5"<<endl; e=2.5; for(int i=3; i<=9; i++) { n=1; for(int j=1; j<=i; j++) n*=j; e+=1/n; printf("%d %.9f\n",i,e); }}
0 0
- HDU 1012 u Calculate e
- HDU 1012 u Calculate e
- HDU 1012 u Calculate e
- HDU--1012--u Calculate e
- hdu 1012 u Calculate e
- HDU 1012 u Calculate e
- hdu 1012 u Calculate e
- u Calculate e hdu 1012
- hdu 1012 u Calculate e
- hdu-1012-u Calculate e
- hdu 1012 u Calculate e
- hdu 1012 u Calculate e
- HDU 1012u Calculate e
- hdu 1012 u Calculate e
- hdu 1012 u Calculate e
- HDU 1012 u Calculate e
- hdu 1012 u Calculate e
- HDU 1012 u Calculate e
- grails domain创建相关问题
- iOS自带扫描 和 生成二维码
- 微软发布最终独立程序正式版本Visual Studio Android模拟器
- 【纵横科技】基于dwr框架的reverseajax消息推送 有图有图!
- 黑马66期android学习笔记16_按钮点击事件
- HDU 1012 u Calculate e
- 动态类型语言和静态类型语言
- Hadoop2.5.2分布式环境搭建
- 使用VLC搭建RTSP服务器
- 正则表达式截取字符串两字符间的内容
- 全面介绍Windows内存管理机制及C++内存分配实例
- hdu 5294 Tricks Device(2015多校第一场第7题)最大流+最短路
- 日常BUG
- HDOJ_Problem Archive_1001_Sum Problem